vim: Fix paste action for visual modes (#43031)

Closes #41810 

Release Notes:

- Fixed paste not working correctly in vim visual modes
This commit is contained in:
Adrian
2025-11-20 11:12:57 -07:00
committed by GitHub
parent 58fe19d55e
commit 18f14a6ebf
3 changed files with 6 additions and 2 deletions
+1 -1
View File
@@ -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;
+1 -1
View File
@@ -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 {
+4
View File
@@ -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));
}