Fix ctrl-r with no register (#13184)

Release Notes:

- N/A
This commit is contained in:
Conrad Irwin 2024-06-17 22:17:33 -06:00 committed by GitHub
parent 0af6e442a7
commit 05c4c7872c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 17 additions and 0 deletions

View File

@ -657,6 +657,13 @@
"ctrl-[": ["vim::SwitchMode", "Normal"] "ctrl-[": ["vim::SwitchMode", "Normal"]
} }
}, },
{
"context": "Editor && vim_mode == insert && VimWaiting",
"bindings": {
"escape": "vim::NormalBefore",
"ctrl-[": "vim::NormalBefore"
}
},
{ {
"context": "BufferSearchBar && !in_replace", "context": "BufferSearchBar && !in_replace",
"bindings": { "bindings": {

View File

@ -124,5 +124,9 @@ mod test {
cx.set_shared_state("heˇllo\n").await; cx.set_shared_state("heˇllo\n").await;
cx.simulate_shared_keystrokes("y y i ctrl-r \"").await; cx.simulate_shared_keystrokes("y y i ctrl-r \"").await;
cx.shared_state().await.assert_eq("hehello\nˇllo\n"); cx.shared_state().await.assert_eq("hehello\nˇllo\n");
cx.simulate_shared_keystrokes("ctrl-r x ctrl-r escape")
.await;
cx.shared_state().await.assert_eq("hehello\nˇllo\n");
} }
} }

View File

@ -896,6 +896,7 @@ impl Vim {
) )
} }
}); });
vim.clear_operator(cx);
} }
_ => { _ => {
vim.select_register(text, cx); vim.select_register(text, cx);

View File

@ -5,3 +5,8 @@
{"Key":"ctrl-r"} {"Key":"ctrl-r"}
{"Key":"\""} {"Key":"\""}
{"Get":{"state":"hehello\nˇllo\n","mode":"Insert"}} {"Get":{"state":"hehello\nˇllo\n","mode":"Insert"}}
{"Key":"ctrl-r"}
{"Key":"x"}
{"Key":"ctrl-r"}
{"Key":"escape"}
{"Get":{"state":"hehello\nˇllo\n","mode":"Insert"}}