Fix dw at the end of a soft wrapped line (#13065)

Co-Authored-By: Richard <richard@zed.dev>
Release Notes:

- vim: Fixed behavior of `dw` at the end of a soft wrapped line

Co-authored-by: Richard <richard@zed.dev>
This commit is contained in:
Conrad Irwin 2024-06-14 13:18:28 -06:00 committed by GitHub
parent e40c49a143
commit 45ae0dcc2d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 30 additions and 8 deletions

View file

@ -873,18 +873,20 @@ impl Motion {
// becomes inclusive. Example: "}" moves to the first line after a paragraph,
// but "d}" will not include that line.
let mut inclusive = self.inclusive();
let start_point = selection.start.to_point(&map);
let mut end_point = selection.end.to_point(&map);
// DisplayPoint
if !inclusive
&& self != &Motion::Backspace
&& selection.end.row() > selection.start.row()
&& selection.end.column() == 0
&& end_point.row > start_point.row
&& end_point.column == 0
{
inclusive = true;
*selection.end.row_mut() -= 1;
*selection.end.column_mut() = 0;
selection.end = map.clip_point(
map.next_line_boundary(selection.end.to_point(map)).1,
Bias::Left,
);
end_point.row -= 1;
end_point.column = 0;
selection.end = map.clip_point(map.next_line_boundary(end_point).1, Bias::Left);
}
if inclusive && selection.end.column() < map.line_len(selection.end.row()) {