mirror of
https://github.com/zed-industries/zed.git
synced 2024-09-19 02:17:35 +03:00
Fix <Enter> to go to non-whitespace character
Fixes: zed-industries/community#831
This commit is contained in:
parent
5029587e3b
commit
93461d366c
@ -651,7 +651,10 @@ fn find_backward(
|
||||
|
||||
fn next_line_start(map: &DisplaySnapshot, point: DisplayPoint, times: usize) -> DisplayPoint {
|
||||
let new_row = (point.row() + times as u32).min(map.max_buffer_row());
|
||||
map.clip_point(DisplayPoint::new(new_row, 0), Bias::Left)
|
||||
first_non_whitespace(
|
||||
map,
|
||||
map.clip_point(DisplayPoint::new(new_row, 0), Bias::Left),
|
||||
)
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
@ -799,4 +802,12 @@ mod test {
|
||||
cx.simulate_shared_keystrokes([","]).await;
|
||||
cx.assert_shared_state("one two thˇree four").await;
|
||||
}
|
||||
|
||||
#[gpui::test]
|
||||
async fn test_next_line_start(cx: &mut gpui::TestAppContext) {
|
||||
let mut cx = NeovimBackedTestContext::new(cx).await;
|
||||
cx.set_shared_state("ˇone\n two\nthree").await;
|
||||
cx.simulate_shared_keystrokes(["enter"]).await;
|
||||
cx.assert_shared_state("one\n ˇtwo\nthree").await;
|
||||
}
|
||||
}
|
||||
|
3
crates/vim/test_data/test_next_line_start.json
Normal file
3
crates/vim/test_data/test_next_line_start.json
Normal file
@ -0,0 +1,3 @@
|
||||
{"Put":{"state":"ˇone\n two\nthree"}}
|
||||
{"Key":"enter"}
|
||||
{"Get":{"state":"one\n ˇtwo\nthree","mode":"Normal"}}
|
Loading…
Reference in New Issue
Block a user