vim: Fix space
not handling non-ascii characters (#27053)
Closes #26806 Changes: Clips the new point with `Bias::Right` like in `saturating_right` Release Notes: - vim: Fixed `space` not handling non-ascii characters
This commit is contained in:
parent
ac5dafc6b2
commit
84a8d48178
2 changed files with 14 additions and 0 deletions
|
@ -1322,6 +1322,7 @@ fn wrapping_right_single(map: &DisplaySnapshot, mut point: DisplayPoint) -> Disp
|
|||
let max_column = map.line_len(point.row()).saturating_sub(1);
|
||||
if point.column() < max_column {
|
||||
*point.column_mut() += 1;
|
||||
point = map.clip_point(point, Bias::Right);
|
||||
} else if point.row() < map.max_point().row() {
|
||||
*point.row_mut() += 1;
|
||||
*point.column_mut() = 0;
|
||||
|
@ -3598,4 +3599,13 @@ mod test {
|
|||
fox jumps over
|
||||
the lˇ»azy dog"});
|
||||
}
|
||||
|
||||
#[gpui::test]
|
||||
async fn test_space_non_ascii(cx: &mut gpui::TestAppContext) {
|
||||
let mut cx = NeovimBackedTestContext::new(cx).await;
|
||||
|
||||
cx.set_shared_state("ˇπππππ").await;
|
||||
cx.simulate_shared_keystrokes("3 space").await;
|
||||
cx.shared_state().await.assert_eq("πππˇππ");
|
||||
}
|
||||
}
|
||||
|
|
4
crates/vim/test_data/test_space_non_ascii.json
Normal file
4
crates/vim/test_data/test_space_non_ascii.json
Normal file
|
@ -0,0 +1,4 @@
|
|||
{"Put":{"state":"ˇπππππ"}}
|
||||
{"Key":"3"}
|
||||
{"Key":"space"}
|
||||
{"Get":{"state":"πππˇππ","mode":"Normal"}}
|
Loading…
Add table
Add a link
Reference in a new issue