Skip to content

Commit

Permalink
Save an undo checkpoint before bracketed paste in insert mode
Browse files Browse the repository at this point in the history
  • Loading branch information
the-mikedavis committed Aug 30, 2023
1 parent 6bef982 commit 6c119f0
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion helix-term/src/ui/editor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1241,12 +1241,17 @@ impl Component for EditorView {

match event {
Event::Paste(contents) => {
let mode = cx.editor.mode();
if mode == Mode::Insert {
let (view, doc) = current!(cx.editor);
doc.append_changes_to_history(view);
}

cx.count = cx.editor.count;
commands::paste_bracketed_value(&mut cx, contents.clone());
cx.editor.count = None;

let config = cx.editor.config();
let mode = cx.editor.mode();
let (view, doc) = current!(cx.editor);
view.ensure_cursor_in_view(doc, config.scrolloff);

Expand Down

0 comments on commit 6c119f0

Please sign in to comment.