mirror of
https://github.com/zed-industries/zed.git
synced 2024-11-08 07:35:01 +03:00
vim: fix v$% (#10051)
Release Notes: - vim: Fixed `%` in visual mode when at the end of a line.
This commit is contained in:
parent
8b586ef8e7
commit
65f0712713
@ -1354,6 +1354,7 @@ fn end_of_document(
|
||||
|
||||
fn matching(map: &DisplaySnapshot, display_point: DisplayPoint) -> DisplayPoint {
|
||||
// https://github.com/vim/vim/blob/1d87e11a1ef201b26ed87585fba70182ad0c468a/runtime/doc/motion.txt#L1200
|
||||
let display_point = map.clip_at_line_end(display_point);
|
||||
let point = display_point.to_point(map);
|
||||
let offset = point.to_offset(&map.buffer_snapshot);
|
||||
|
||||
@ -2109,4 +2110,23 @@ mod test {
|
||||
"})
|
||||
.await;
|
||||
}
|
||||
|
||||
#[gpui::test]
|
||||
async fn test_visual_match_eol(cx: &mut gpui::TestAppContext) {
|
||||
let mut cx = NeovimBackedTestContext::new(cx).await;
|
||||
|
||||
cx.set_shared_state(indoc! {"
|
||||
fn aˇ() {
|
||||
return
|
||||
}
|
||||
"})
|
||||
.await;
|
||||
cx.simulate_shared_keystrokes(["v", "$", "%"]).await;
|
||||
cx.assert_shared_state(indoc! {"
|
||||
fn a«() {
|
||||
return
|
||||
}ˇ»
|
||||
"})
|
||||
.await;
|
||||
}
|
||||
}
|
||||
|
5
crates/vim/test_data/test_visual_match_eol.json
Normal file
5
crates/vim/test_data/test_visual_match_eol.json
Normal file
@ -0,0 +1,5 @@
|
||||
{"Put":{"state":"fn aˇ() {\n return\n}\n"}}
|
||||
{"Key":"v"}
|
||||
{"Key":"$"}
|
||||
{"Key":"%"}
|
||||
{"Get":{"state":"fn a«() {\n return\n}ˇ»\n","mode":"Visual"}}
|
Loading…
Reference in New Issue
Block a user