Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

Fix register selection in visual mode (#18418)

Conrad Irwin32605e9ea4d9
diff --git a/crates/vim/src/normal/mark.rs b/crates/vim/src/normal/mark.rs
index 787430e747e..743ab59ee28 100644
--- a/crates/vim/src/normal/mark.rs
+++ b/crates/vim/src/normal/mark.rs
@@ -63,7 +63,6 @@ impl Vim {
self.marks.insert("<".to_string(), starts);
self.marks.insert(">".to_string(), ends);
self.stored_visual_mode.replace((mode, reversed));
- self.clear_operator(cx);
}
pub fn jump(&mut self, text: Arc<str>, line: bool, cx: &mut ViewContext<Self>) {
diff --git a/crates/vim/src/normal/paste.rs b/crates/vim/src/normal/paste.rs
index 05469dbf9f1..5322f913c17 100644
--- a/crates/vim/src/normal/paste.rs
+++ b/crates/vim/src/normal/paste.rs
@@ -673,6 +673,9 @@ mod test {
cx.simulate_shared_keystrokes("\" _ d d").await;
cx.shared_register('_').await.assert_eq("");
+ cx.simulate_shared_keystrokes("shift-v \" _ y w").await;
+ cx.shared_register('"').await.assert_eq("jumps");
+
cx.shared_state().await.assert_eq(indoc! {"
The quick brown
the ˇlazy dog"});
diff --git a/crates/vim/test_data/test_special_registers.json b/crates/vim/test_data/test_special_registers.json
index 8b6b098af65..35f181a05c4 100644
--- a/crates/vim/test_data/test_special_registers.json
+++ b/crates/vim/test_data/test_special_registers.json
@@ -10,6 +10,13 @@
{"Key":"d"}
{"Get":{"state":"The quick brown\nthe ˇlazy dog","mode":"Normal"}}
{"ReadRegister":{"name":"_","value":""}}
+{"Key":"shift-v"}
+{"Key":"\""}
+{"Key":"_"}
+{"Key":"y"}
+{"Key":"w"}
+{"Get":{"state":"The quick brown\nthe ˇlazy dog","mode":"Normal"}}
+{"ReadRegister":{"name":"\"","value":"jumps"}}
{"Get":{"state":"The quick brown\nthe ˇlazy dog","mode":"Normal"}}
{"Key":"\""}
{"Key":"\""}