From 6ef36e958254b873684621bb91d1ba299e2d9d7d Mon Sep 17 00:00:00 2001 From: JJ Date: Sat, 15 Jul 2023 17:42:04 -0700 Subject: [PATCH 1/2] Fix writes from insert mode not properly updating the revision history ref: https://github.com/helix-editor/helix/pull/7226 --- helix-term/src/commands/typed.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/helix-term/src/commands/typed.rs b/helix-term/src/commands/typed.rs index dfc71dfd..3f746bf0 100644 --- a/helix-term/src/commands/typed.rs +++ b/helix-term/src/commands/typed.rs @@ -350,6 +350,8 @@ fn write_impl( None }; + doc.append_changes_to_history(view); + if fmt.is_none() { let id = doc.id(); cx.editor.save(id, path, force)?; -- 2.41.0 From 8305a40ec1fba47295987e8e8278a4aa2061009e Mon Sep 17 00:00:00 2001 From: JJ Date: Sat, 15 Jul 2023 17:44:04 -0700 Subject: [PATCH 2/2] Write pre-manipulation pastes to the revision history --- helix-term/src/ui/editor.rs | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/helix-term/src/ui/editor.rs b/helix-term/src/ui/editor.rs index 5b5cda93..252aff0d 100644 --- a/helix-term/src/ui/editor.rs +++ b/helix-term/src/ui/editor.rs @@ -1240,15 +1240,9 @@ fn handle_event( 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); - - // Store a history state if not in insert mode. Otherwise wait till we exit insert - // to include any edits to the paste in the history state. - if mode != Mode::Insert { - doc.append_changes_to_history(view); - } + doc.append_changes_to_history(view); EventResult::Consumed(None) } -- 2.41.0