From: Michael D. Lowis Date: Thu, 5 Jan 2017 17:59:46 +0000 (-0500) Subject: Undo and Redo tags now always apply to the edit region. ctrl+z + ctrl+y still apply... X-Git-Url: https://git.mdlowis.com/?a=commitdiff_plain;h=74b5faf55e9df17be63e9bf0c03b373067368feb;p=projs%2Ftide.git Undo and Redo tags now always apply to the edit region. ctrl+z + ctrl+y still apply to the focused region --- diff --git a/TODO.md b/TODO.md index 2b88dec..ee8d344 100644 --- 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 265f236..90e7c25 100644 --- 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) {