mirror of
https://github.com/helix-editor/helix.git
synced 2025-01-18 13:07:06 +04:00
4bd17e542e
#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 |
||
---|---|---|
.. | ||
src | ||
tests | ||
.gitignore | ||
build.rs | ||
Cargo.toml |