From 350535208f134f1d8a6201833ad560905fea5abc Mon Sep 17 00:00:00 2001 From: Pascal Kuthe Date: Thu, 2 Feb 2023 20:56:52 +0100 Subject: always commit to history when pasting (#5790) --- helix-term/src/commands.rs | 1 + helix-term/src/commands/typed.rs | 4 ++++ 2 files changed, 5 insertions(+) (limited to 'helix-term') diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs index 7d5f2241..d1dc9223 100644 --- a/helix-term/src/commands.rs +++ b/helix-term/src/commands.rs @@ -3746,6 +3746,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 ec7100a6..f2495d8c 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(()) } -- cgit v1.2.3-70-g09d2