Skip to content

Commit 49b1f2a

Browse files
committed
Fix writes from insert mode not properly updating the revision history
ref: helix-editor/helix#3501 ref: helix-editor/helix#6513 ref: helix-editor/helix#7226
1 parent f441f05 commit 49b1f2a

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

helix-term/src/commands/typed.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -355,6 +355,8 @@ fn write_impl(
355355
None
356356
};
357357

358+
doc.append_changes_to_history(view);
359+
358360
if fmt.is_none() {
359361
let id = doc.id();
360362
cx.editor.save(id, path, force)?;
@@ -732,6 +734,9 @@ pub fn write_all_impl(
732734
None
733735
};
734736

737+
let view = view_mut!(cx.editor);
738+
doc.append_changes_to_history(view);
739+
735740
if fmt.is_none() {
736741
cx.editor.save::<PathBuf>(doc_id, None, force)?;
737742
}

helix-term/src/ui/editor.rs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1311,15 +1311,9 @@ impl Component for EditorView {
13111311
cx.editor.count = None;
13121312

13131313
let config = cx.editor.config();
1314-
let mode = cx.editor.mode();
13151314
let (view, doc) = current!(cx.editor);
13161315
view.ensure_cursor_in_view(doc, config.scrolloff);
1317-
1318-
// Store a history state if not in insert mode. Otherwise wait till we exit insert
1319-
// to include any edits to the paste in the history state.
1320-
if mode != Mode::Insert {
1321-
doc.append_changes_to_history(view);
1322-
}
1316+
doc.append_changes_to_history(view);
13231317

13241318
EventResult::Consumed(None)
13251319
}

0 commit comments

Comments
 (0)