aboutsummaryrefslogtreecommitdiff
path: root/helix-term/src/commands.rs
diff options
context:
space:
mode:
authorMichael Davis2022-11-23 14:57:03 +0000
committerBlaž Hrastnik2022-11-24 01:57:12 +0000
commitfd00f3a70eb626242bb2fcc9bddf2c4d94580a9a (patch)
tree3c389daef7707519caa78cfe33104875b1022b70 /helix-term/src/commands.rs
parent94eb3de7767c5d16344bec9634028f346cd867bb (diff)
Don't apply transactions to Views in undo/redo
View::apply should only be called by EditorView after 42e37a571e75aaf4feb1717dfebe8cf215e535dd. This change removes the duplicate calls within undo/redo which could cause a panic.
Diffstat (limited to 'helix-term/src/commands.rs')
-rw-r--r--helix-term/src/commands.rs8
1 files changed, 4 insertions, 4 deletions
diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs
index 8af5a7e3..4eb9742f 100644
--- a/helix-term/src/commands.rs
+++ b/helix-term/src/commands.rs
@@ -3302,7 +3302,7 @@ fn undo(cx: &mut Context) {
let count = cx.count();
let (view, doc) = current!(cx.editor);
for _ in 0..count {
- if !doc.undo(view) {
+ if !doc.undo(view.id) {
cx.editor.set_status("Already at oldest change");
break;
}
@@ -3313,7 +3313,7 @@ fn redo(cx: &mut Context) {
let count = cx.count();
let (view, doc) = current!(cx.editor);
for _ in 0..count {
- if !doc.redo(view) {
+ if !doc.redo(view.id) {
cx.editor.set_status("Already at newest change");
break;
}
@@ -3325,7 +3325,7 @@ fn earlier(cx: &mut Context) {
let (view, doc) = current!(cx.editor);
for _ in 0..count {
// rather than doing in batch we do this so get error halfway
- if !doc.earlier(view, UndoKind::Steps(1)) {
+ if !doc.earlier(view.id, UndoKind::Steps(1)) {
cx.editor.set_status("Already at oldest change");
break;
}
@@ -3337,7 +3337,7 @@ fn later(cx: &mut Context) {
let (view, doc) = current!(cx.editor);
for _ in 0..count {
// rather than doing in batch we do this so get error halfway
- if !doc.later(view, UndoKind::Steps(1)) {
+ if !doc.later(view.id, UndoKind::Steps(1)) {
cx.editor.set_status("Already at newest change");
break;
}