mirror of
https://github.com/helix-editor/helix.git
synced 2024-11-24 10:26:18 +04:00
Add changes for undo in insert mode (#11090)
* Add changes before insert mode undo Fixes #11077 * Address edge cases for undo like Kakoune does --------- Co-authored-by: Kaniel Kirby <pirate7007@runbox.com> Co-authored-by: Michael Davis <mcarsondavis@gmail.com>
This commit is contained in:
parent
71df2428ee
commit
86e4b51416
@ -1410,6 +1410,11 @@ pub fn apply_temporary(&mut self, transaction: &Transaction, view_id: ViewId) ->
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn undo_redo_impl(&mut self, view: &mut View, undo: bool) -> bool {
|
fn undo_redo_impl(&mut self, view: &mut View, undo: bool) -> bool {
|
||||||
|
if undo {
|
||||||
|
self.append_changes_to_history(view);
|
||||||
|
} else if !self.changes.is_empty() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
let mut history = self.history.take();
|
let mut history = self.history.take();
|
||||||
let txn = if undo { history.undo() } else { history.redo() };
|
let txn = if undo { history.undo() } else { history.redo() };
|
||||||
let success = if let Some(txn) = txn {
|
let success = if let Some(txn) = txn {
|
||||||
@ -1490,6 +1495,11 @@ pub fn restore(&mut self, view: &mut View, savepoint: &SavePoint, emit_lsp_notif
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn earlier_later_impl(&mut self, view: &mut View, uk: UndoKind, earlier: bool) -> bool {
|
fn earlier_later_impl(&mut self, view: &mut View, uk: UndoKind, earlier: bool) -> bool {
|
||||||
|
if earlier {
|
||||||
|
self.append_changes_to_history(view);
|
||||||
|
} else if !self.changes.is_empty() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
let txns = if earlier {
|
let txns = if earlier {
|
||||||
self.history.get_mut().earlier(uk)
|
self.history.get_mut().earlier(uk)
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user