always commit to history when pasting (#5790)

pull/5793/head
Pascal Kuthe 2 years ago committed by GitHub
parent a5233cf5ad
commit 350535208f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -3746,6 +3746,7 @@ fn paste_impl(
} }
doc.apply(&transaction, view.id); doc.apply(&transaction, view.id);
doc.append_changes_to_history(view);
} }
pub(crate) fn paste_bracketed_value(cx: &mut Context, contents: String) { pub(crate) fn paste_bracketed_value(cx: &mut Context, contents: String) {

@ -913,6 +913,7 @@ fn replace_selections_with_clipboard_impl(
cx: &mut compositor::Context, cx: &mut compositor::Context,
clipboard_type: ClipboardType, clipboard_type: ClipboardType,
) -> anyhow::Result<()> { ) -> anyhow::Result<()> {
let scrolloff = cx.editor.config().scrolloff;
let (view, doc) = current!(cx.editor); let (view, doc) = current!(cx.editor);
match cx.editor.clipboard_provider.get_contents(clipboard_type) { 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.apply(&transaction, view.id);
doc.append_changes_to_history(view); doc.append_changes_to_history(view);
view.ensure_cursor_in_view(doc, scrolloff);
Ok(()) Ok(())
} }
Err(e) => Err(e.context("Couldn't get system clipboard contents")), Err(e) => Err(e.context("Couldn't get system clipboard contents")),
@ -1570,6 +1572,7 @@ fn sort_impl(
_args: &[Cow<str>], _args: &[Cow<str>],
reverse: bool, reverse: bool,
) -> anyhow::Result<()> { ) -> anyhow::Result<()> {
let scrolloff = cx.editor.config().scrolloff;
let (view, doc) = current!(cx.editor); let (view, doc) = current!(cx.editor);
let text = doc.text().slice(..); let text = doc.text().slice(..);
@ -1595,6 +1598,7 @@ fn sort_impl(
doc.apply(&transaction, view.id); doc.apply(&transaction, view.id);
doc.append_changes_to_history(view); doc.append_changes_to_history(view);
view.ensure_cursor_in_view(doc, scrolloff);
Ok(()) Ok(())
} }

Loading…
Cancel
Save