Skip to content

Commit

Permalink
always commit to history when pasting (#5790)
Browse files Browse the repository at this point in the history
  • Loading branch information
pascalkuthe committed Feb 2, 2023
1 parent a5233cf commit 3505352
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 @@ -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) {
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 3505352

Please sign in to comment.