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
1 changed files with 10 additions and 0 deletions
|
@ -1410,6 +1410,11 @@ impl Document {
|
||||||
}
|
}
|
||||||
|
|
||||||
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 @@ impl Document {
|
||||||
}
|
}
|
||||||
|
|
||||||
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…
Add table
Reference in a new issue