]> git.mdlowis.com Git - projs/tide.git/commitdiff
Undo and Redo tags now always apply to the edit region. ctrl+z + ctrl+y still apply...
authorMichael D. Lowis <mike.lowis@gentex.com>
Thu, 5 Jan 2017 17:59:46 +0000 (12:59 -0500)
committerMichael D. Lowis <mike.lowis@gentex.com>
Thu, 5 Jan 2017 17:59:46 +0000 (12:59 -0500)
TODO.md
xedit.c

diff --git a/TODO.md b/TODO.md
index 2b88dec97a71cbc31dd53d39e07d94ba517b4a37..ee8d344d2e2c984705c8aeb70da660884048a3df 100644 (file)
--- a/TODO.md
+++ b/TODO.md
@@ -2,7 +2,6 @@
 
 Up Next:
 
-* Undo/Redo tags should apply to  the edit buffer, ctrl+z + ctrl+y to the current buffer
 * Tag line count should account for wrapped lines
 * block selection should handle brace-balancing
 * context sensitive selection of words, commands, line numbers, or filenames.
diff --git a/xedit.c b/xedit.c
index 265f23688c2aeb2b762a7cbdb3af95cc1b3a8d7a..90e7c259cce8b1a5d2de2977d0efe301c4914a36 100644 (file)
--- a/xedit.c
+++ b/xedit.c
@@ -49,6 +49,8 @@ static void quit(void);
 static void save(void);
 static void undo(void);
 static void redo(void);
+static void tag_undo(void);
+static void tag_redo(void);
 static void cut(void);
 static void copy(void);
 static void paste(void);
@@ -108,8 +110,8 @@ Tag Builtins[] = {
     { .tag = "Cut",    .action.noarg = cut      },
     { .tag = "Copy",   .action.noarg = copy     },
     { .tag = "Paste",  .action.noarg = paste    },
-    { .tag = "Undo",   .action.noarg = undo     },
-    { .tag = "Redo",   .action.noarg = redo     },
+    { .tag = "Undo",   .action.noarg = tag_undo },
+    { .tag = "Redo",   .action.noarg = tag_redo },
     { .tag = "Find",   .action.arg   = find     },
     { .tag = "Tabs",   .action.noarg = tabs     },
     { .tag = "Indent", .action.noarg = indent   },
@@ -506,6 +508,14 @@ static void redo(void) {
     view_redo(currview());
 }
 
+static void tag_undo(void) {
+    view_undo(getview(EDIT));
+}
+
+static void tag_redo(void) {
+    view_redo(getview(EDIT));
+}
+
 static void cut(void) {
     char* str = view_getstr(currview(), NULL);
     if (str && *str) {