vim: Fix space forward bug with non-ASCII characters at EOL (#27860)
Closes https://github.com/zed-industries/zed/issues/27619 Fixes issue with right wrapped movement when a multi-byte character is at the end of the line. This is done by grabbing the last character on the current row and using that characters size to calculate the `max_column` variable, which is used to decide if the next right movement should move down the line or not. We did notice a bit of code that could be an issue that we wanted to call out. [Here](https://github.com/zed-industries/zed/blob/main/crates/editor/src/display_map.rs#L1070) inside of `clip_at_line_end` it also does a saturating_sub(1), assuming a single byte character. We didn't run into any issues due to this line but felt like a similar bug. We can apply a similar fix if wanted to pose the question first. Test case: Moving to next line when eol is a multi-byte character https://github.com/user-attachments/assets/1021ab1f-f49d-4986-8f9a-8cfc7e5c91bc Release Notes: - Fixed issue in vim forward spacing when a multi-byte character is at the eol --------- Co-authored-by: KyleBarton <kjbarton4@gmail.com>
This commit is contained in:
parent
64ef3ab09d
commit
bda33ec436
4 changed files with 52 additions and 9 deletions
4
crates/vim/test_data/test_backspace_non_ascii_bol.json
Normal file
4
crates/vim/test_data/test_backspace_non_ascii_bol.json
Normal file
|
@ -0,0 +1,4 @@
|
|||
{"Put":{"state":"ππππ\nπanˇotherline"}}
|
||||
{"Key":"4"}
|
||||
{"Key":"backspace"}
|
||||
{"Get":{"state":"πππˇπ\nπanotherline","mode":"Normal"}}
|
4
crates/vim/test_data/test_space_non_ascii_eol.json
Normal file
4
crates/vim/test_data/test_space_non_ascii_eol.json
Normal file
|
@ -0,0 +1,4 @@
|
|||
{"Put":{"state":"ππππˇπ\nπanotherline"}}
|
||||
{"Key":"4"}
|
||||
{"Key":"space"}
|
||||
{"Get":{"state":"πππππ\nπanˇotherline","mode":"Normal"}}
|
4
crates/vim/test_data/test_space_only_ascii_eol.json
Normal file
4
crates/vim/test_data/test_space_only_ascii_eol.json
Normal file
|
@ -0,0 +1,4 @@
|
|||
{"Put":{"state":"aaaaˇaa\nanotherline"}}
|
||||
{"Key":"4"}
|
||||
{"Key":"space"}
|
||||
{"Get":{"state":"aaaaaa\nanˇotherline","mode":"Normal"}}
|
Loading…
Add table
Add a link
Reference in a new issue