Skip to content

Commit

Permalink
always commit to history when pasting
Browse files Browse the repository at this point in the history
  • Loading branch information
pascalkuthe committed Feb 2, 2023
1 parent 2949bb0 commit 5ff7d44
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions helix-term/src/commands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
4 changes: 4 additions & 0 deletions helix-term/src/commands/typed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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")),
Expand Down Expand Up @@ -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(..);

Expand All @@ -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(())
}
Expand Down

0 comments on commit 5ff7d44

Please sign in to comment.