mirror of
https://github.com/zed-industries/zed.git
synced 2024-11-08 07:35:01 +03:00
vim: Fix c
when range ends in a multibyte character (#14139)
Release Notes: - vim: Fixed `c <motion>` omitting trailing multibyte characters ([#13909](https://github.com/zed-industries/zed/issues/13909)).
This commit is contained in:
parent
d49727ff10
commit
018a2a29ea
@ -890,7 +890,7 @@ impl Motion {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if inclusive && selection.end.column() < map.line_len(selection.end.row()) {
|
if inclusive && selection.end.column() < map.line_len(selection.end.row()) {
|
||||||
*selection.end.column_mut() += 1;
|
selection.end = movement::saturating_right(map, selection.end)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Some(selection.start..selection.end)
|
Some(selection.start..selection.end)
|
||||||
|
@ -1266,3 +1266,16 @@ async fn test_toggle_comments(cx: &mut gpui::TestAppContext) {
|
|||||||
Mode::Normal,
|
Mode::Normal,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[gpui::test]
|
||||||
|
async fn test_find_multibyte(cx: &mut gpui::TestAppContext) {
|
||||||
|
let mut cx = NeovimBackedTestContext::new(cx).await;
|
||||||
|
|
||||||
|
cx.set_shared_state(r#"<label for="guests">ˇPočet hostů</label>"#)
|
||||||
|
.await;
|
||||||
|
|
||||||
|
cx.simulate_shared_keystrokes("c t < o escape").await;
|
||||||
|
cx.shared_state()
|
||||||
|
.await
|
||||||
|
.assert_eq(r#"<label for="guests">ˇo</label>"#);
|
||||||
|
}
|
||||||
|
7
crates/vim/test_data/test_find_multibyte.json
Normal file
7
crates/vim/test_data/test_find_multibyte.json
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
{"Put":{"state":"<label for=\"guests\">ˇPočet hostů</label>"}}
|
||||||
|
{"Key":"c"}
|
||||||
|
{"Key":"t"}
|
||||||
|
{"Key":"<"}
|
||||||
|
{"Key":"o"}
|
||||||
|
{"Key":"escape"}
|
||||||
|
{"Get":{"state":"<label for=\"guests\">ˇo</label>","mode":"Normal"}}
|
Loading…
Reference in New Issue
Block a user