crates/vim/src/normal.rs 🔗
@@ -3,7 +3,7 @@ mod convert;
mod delete;
mod increment;
pub(crate) mod mark;
-mod paste;
+pub(crate) mod paste;
pub(crate) mod repeat;
mod scroll;
pub(crate) mod search;
Adrian created
Closes #41810
Release Notes:
- Fixed paste not working correctly in vim visual modes
crates/vim/src/normal.rs | 2 +-
crates/vim/src/normal/paste.rs | 2 +-
crates/vim/src/vim.rs | 4 ++++
3 files changed, 6 insertions(+), 2 deletions(-)
@@ -3,7 +3,7 @@ mod convert;
mod delete;
mod increment;
pub(crate) mod mark;
-mod paste;
+pub(crate) mod paste;
pub(crate) mod repeat;
mod scroll;
pub(crate) mod search;
@@ -18,7 +18,7 @@ use crate::{
};
/// Pastes text from the specified register at the cursor position.
-#[derive(Clone, Deserialize, JsonSchema, PartialEq, Action)]
+#[derive(Clone, Default, Deserialize, JsonSchema, PartialEq, Action)]
#[action(namespace = vim)]
#[serde(deny_unknown_fields)]
pub struct Paste {
@@ -19,6 +19,7 @@ mod state;
mod surrounds;
mod visual;
+use crate::normal::paste::Paste as VimPaste;
use collections::HashMap;
use editor::{
Anchor, Bias, Editor, EditorEvent, EditorSettings, HideMouseCursorOrigin, MultiBufferOffset,
@@ -922,6 +923,9 @@ impl Vim {
cx,
|vim, _: &editor::actions::Paste, window, cx| match vim.mode {
Mode::Replace => vim.paste_replace(window, cx),
+ Mode::Visual | Mode::VisualLine | Mode::VisualBlock => {
+ vim.paste(&VimPaste::default(), window, cx);
+ }
_ => {
vim.update_editor(cx, |_, editor, cx| editor.paste(&Paste, window, cx));
}