vim: Fix end of paragraph deletion when there's no blank lines (#29490)
This Pull Request attempts to fix an issue where using `d}` in vim mode would not delete all characters in case there's no blank lines at the end of the buffer. When calculating the end point for this motion, if there's no blank lines at the end of the buffer, Zed was calculating it to be the last character in the last line. However, if there's a newline at the end of the buffer, it calculates the end point to be the point at the right of the last character. Here's an example, for the following buffer contents: ``` Hello! Hello! ``` If the `d}` command is run at `(0, 0)`, the end point will be set to `(1, 5)`. However, fi the same command is run for this buffer instead: ``` Hello! Hello! ``` The end point will be set to `(1, 6)`, there's a 1 unit difference in the column, which leads to all characters actually being deleted. Closes #29393 Release Notes: - Fixed deleting to the end of paragraph when there's no blank lines --------- Co-authored-by: Conrad Irwin <conrad.irwin@gmail.com>
This commit is contained in:
parent
4758173c33
commit
f2813f60ed
3 changed files with 41 additions and 0 deletions
8
crates/vim/test_data/test_delete_end_of_paragraph.json
Normal file
8
crates/vim/test_data/test_delete_end_of_paragraph.json
Normal file
|
@ -0,0 +1,8 @@
|
|||
{"Put":{"state":"ˇhello world.\n\nhello world."}}
|
||||
{"Key":"d"}
|
||||
{"Key":"}"}
|
||||
{"Get":{"state":"ˇ\nhello world.","mode":"Normal"}}
|
||||
{"Put":{"state":"ˇhello world.\nhello world."}}
|
||||
{"Key":"d"}
|
||||
{"Key":"}"}
|
||||
{"Get":{"state":"ˇ","mode":"Normal"}}
|
Loading…
Add table
Add a link
Reference in a new issue