diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs index 4f27fc801f46..de7cc0c913bc 100644 --- a/helix-term/src/commands.rs +++ b/helix-term/src/commands.rs @@ -3734,6 +3734,7 @@ fn paste_impl( } doc.apply(&transaction, view.id); + doc.append_changes_to_history(view); } pub(crate) fn paste_bracketed_value(cx: &mut Context, contents: String) { diff --git a/helix-term/src/commands/typed.rs b/helix-term/src/commands/typed.rs index ec7100a63740..f2495d8ce63c 100644 --- a/helix-term/src/commands/typed.rs +++ b/helix-term/src/commands/typed.rs @@ -913,6 +913,7 @@ fn replace_selections_with_clipboard_impl( cx: &mut compositor::Context, clipboard_type: ClipboardType, ) -> anyhow::Result<()> { + let scrolloff = cx.editor.config().scrolloff; let (view, doc) = current!(cx.editor); match cx.editor.clipboard_provider.get_contents(clipboard_type) { @@ -924,6 +925,7 @@ fn replace_selections_with_clipboard_impl( doc.apply(&transaction, view.id); doc.append_changes_to_history(view); + view.ensure_cursor_in_view(doc, scrolloff); Ok(()) } Err(e) => Err(e.context("Couldn't get system clipboard contents")), @@ -1570,6 +1572,7 @@ fn sort_impl( _args: &[Cow], reverse: bool, ) -> anyhow::Result<()> { + let scrolloff = cx.editor.config().scrolloff; let (view, doc) = current!(cx.editor); let text = doc.text().slice(..); @@ -1595,6 +1598,7 @@ fn sort_impl( doc.apply(&transaction, view.id); doc.append_changes_to_history(view); + view.ensure_cursor_in_view(doc, scrolloff); Ok(()) }