aboutsummaryrefslogtreecommitdiff
path: root/helix-term/src
diff options
context:
space:
mode:
authorBlaž Hrastnik2020-12-21 04:58:54 +0000
committerBlaž Hrastnik2020-12-21 04:58:54 +0000
commitea502c8665332932b2311df3852b5ac8df6509af (patch)
treef9dc0b8183b63f803780fa8e2189dc5aeab2f52f /helix-term/src
parentd1810272257f597ddba4fd3496dbdde8cda59638 (diff)
fix change -> change -> undo -> change -> undo -> undo.
Diffstat (limited to 'helix-term/src')
-rw-r--r--helix-term/src/commands.rs16
1 files changed, 5 insertions, 11 deletions
diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs
index a8aea914..7722eca5 100644
--- a/helix-term/src/commands.rs
+++ b/helix-term/src/commands.rs
@@ -660,21 +660,15 @@ pub fn insert_char_prompt(prompt: &mut Prompt, c: char) {
// Undo / Redo
-pub fn undo(cx: &mut Context) {
- if let Some(revert) = cx.view.doc.history.undo() {
- cx.view.doc.version += 1;
- cx.view.doc.apply(&revert);
- // TODO: undo/redo needs to avoid storing in self.changes/self.old_state
- }
+// TODO: each command could simply return a Option<transaction>, then the higher level handles
+// storing it?
- // TODO: each command could simply return a Option<transaction>, then the higher level handles storing it?
+pub fn undo(cx: &mut Context) {
+ cx.view.doc.undo();
}
pub fn redo(cx: &mut Context) {
- if let Some(transaction) = cx.view.doc.history.redo() {
- cx.view.doc.version += 1;
- cx.view.doc.apply(&transaction);
- }
+ cx.view.doc.redo();
}
// Yank / Paste