Commit Graph

8 Commits (7dcddf98c6e0ae6b307c49cb26a7e67ca70f0ea0)

Author SHA1 Message Date
CalebLarsen 7dcddf98c6
Append changes to history on jumps (#13619)
Co-authored-by: Michael Davis <mcarsondavis@gmail.com>
2025-05-27 09:44:47 -05:00
Michael Davis 702a961517
Fix `try_restore_indent` on non-LF documents
On Windows for example the behavior of this function typically diverges
from the usual behavior on Unix. Instead of checking that the inserted
string starts with `'\n'` (untrue for for CRLF line endings) we need to
check that the first grapheme cluster in the string is a line ending.
(All line endings are single grapheme clusters.)
2025-05-24 11:42:29 -04:00
Nikita Revenco 076d8bd173
fix: surprising behaviour when changing line above a comment (#12575)
Co-authored-by: Nikita Revenco <154856872+NikitaRevenco@users.noreply.github.com>
2025-01-17 15:29:39 -06:00
Michael Davis 4bd17e542e
Fix offset tracking in `insert_newline`
#12177 changed `insert_newline`'s behavior to trim any trailing
whitespace on a line which came before a cursor. `insert_newline` would
previously never delete text. Even the whitespace stripping behavior in
#4854 worked by inserting text - a line ending at the beginning of the
line. `global_offs`, a variable that tracks the number of characters
inserted between iterations over the existing selection ranges, was not
updated to also account for text deleted by the trimming behavior,
causing cursors to be offset by the amount of trailing space deleted
and causing panics in some cases.

To fix this we need to subtract the number of trimmed whitespace
characters from `global_offs`. `global_offs` must become an `isize`
(was a `usize`) because it may become negative in cases where a lot of
trailing whitespace is trimmed. Integration tests have been added for
each of these cases.

Fixes #12461
Fixes #12495
Fixes #12539
2025-01-15 10:36:29 -05:00
TornaxO7 60bff8feee
Fix `open_{below, above}` behaviour with multiple cursors (#12465) 2025-01-13 08:14:30 -06:00
TornaxO7 89a7cde2f0
Fix continuing comment token for first line (#12215) 2024-12-10 13:24:34 -06:00
Michael Davis fd3e889927 Add integration tests for line comment continuation 2024-12-05 20:53:53 +09:00
Michael Davis 1e6fe00001 Trim all trailing whitespace on insert_newline 2024-12-05 20:53:53 +09:00