always commit to history when pasting (#5790)

This commit is contained in:
Pascal Kuthe 2023-02-02 20:56:52 +01:00 committed by GitHub
parent a5233cf5ad
commit 350535208f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 0 deletions

View file

@ -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) {

View file

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