aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPascal Kuthe2023-02-02 19:56:52 +0000
committerGitHub2023-02-02 19:56:52 +0000
commit350535208f134f1d8a6201833ad560905fea5abc (patch)
treee98248bac6009def72c352a66ca7a268fe133f17
parenta5233cf5ad3c4f8e95228314463cf41d744fac04 (diff)
always commit to history when pasting (#5790)
-rw-r--r--helix-term/src/commands.rs1
-rw-r--r--helix-term/src/commands/typed.rs4
2 files changed, 5 insertions, 0 deletions
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<str>],
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(())
}