]> git.mdlowis.com Git - projs/tide.git/commitdiff
added shortcut to select all
authorMichael D. Lowis <mike@mdlowis.com>
Sat, 27 May 2017 02:07:52 +0000 (22:07 -0400)
committerMichael D. Lowis <mike@mdlowis.com>
Sat, 27 May 2017 02:07:52 +0000 (22:07 -0400)
TODO.md
inc/shortcuts.h
tide.c

diff --git a/TODO.md b/TODO.md
index eeba37123fc9c4a32545a44d1eaf29d7afc57da4..dde7a24f35f92d47a22aa3a241541dcb2ff50020 100644 (file)
--- a/TODO.md
+++ b/TODO.md
@@ -3,7 +3,6 @@
 Up Next:
 
 * Change PageUp/Dn to move cursor by screenfuls
-* Add Ctrl+Shift+A shortcut to select all
 * move by words is inconsistent. Example:
     var infoId = 'readerinfo'+reader.id;
 * Add a way to CD using a builtin (buffers will track original dir)
index a2bece2458fb8990fb38dfc0602d36feccb2a414..a3a6258e570f0be608dc202f0ba538fbafe4840b 100644 (file)
@@ -4,6 +4,12 @@ static void select_line(void) {
     view_selctx(view);
 }
 
+static void select_all(void) {
+    View* view = win_view(FOCUSED);
+    view->selection.beg = 0;
+    view->selection.end = buf_end(&(view->buffer));
+}
+
 static void join_lines(void) {
     View* view = win_view(FOCUSED);
     view_eol(view, false);
diff --git a/tide.c b/tide.c
index e91798aa7050d9551850a4bc03e9ed07cf404b9b..ad45db00942be2c8d9e132356ec67d45c7c3f55c 100644 (file)
--- a/tide.c
+++ b/tide.c
@@ -363,7 +363,7 @@ static void eol_mode(void) {
 }
 
 static void new_win(void) {
-    cmd_exec("!edit");
+    cmd_exec("!tide");
 }
 
 static void newline(void) {
@@ -432,14 +432,15 @@ static KeyBinding Bindings[] = {
     { ModCtrl, 'e', cursor_eol  },
 
     /* Standard Text Editing Shortcuts */
-    { ModCtrl, 's', save        },
-    { ModCtrl, 'z', undo        },
-    { ModCtrl, 'y', redo        },
-    { ModCtrl, 'x', cut         },
-    { ModCtrl, 'c', copy        },
-    { ModCtrl, 'v', paste       },
-    { ModCtrl, 'j', join_lines  },
-    { ModCtrl, 'l', select_line },
+    { ModCtrl,          's', save        },
+    { ModCtrl,          'z', undo        },
+    { ModCtrl,          'y', redo        },
+    { ModCtrl,          'x', cut         },
+    { ModCtrl,          'c', copy        },
+    { ModCtrl,          'v', paste       },
+    { ModCtrl,          'j', join_lines  },
+    { ModCtrl,          'l', select_line },
+    { ModCtrl|ModShift, 'a', select_all  },
 
     /* Block Indent */
     { ModCtrl, '[', del_indent },
@@ -464,18 +465,18 @@ static KeyBinding Bindings[] = {
     { ModOneOrMore, '9', jumpmark },
 
     /* Implementation Specific */
-    { ModNone,                 KEY_ESCAPE, select_prev  },
-    { ModCtrl,                 't',        change_focus },
-    { ModCtrl,                 'q',        quit         },
-    { ModCtrl,                 'h',        highlight    },
-    { ModOneOrMore,            'f',        search       },
-    { ModCtrl,                 'd',        execute      },
-    { ModCtrl,                 'o',        open_file    },
-    { ModCtrl,                 'p',        pick_ctag    },
-    { ModOneOrMore,            'g',        goto_ctag    },
-    { ModCtrl,                 'n',        new_win      },
-    { ModOneOrMore,            '\n',       newline      },
-    { ModCtrl,                 ' ',        complete     },
+    { ModNone,      KEY_ESCAPE, select_prev  },
+    { ModCtrl,      't',        change_focus },
+    { ModCtrl,      'q',        quit         },
+    { ModCtrl,      'h',        highlight    },
+    { ModOneOrMore, 'f',        search       },
+    { ModCtrl,      'd',        execute      },
+    { ModCtrl,      'o',        open_file    },
+    { ModCtrl,      'p',        pick_ctag    },
+    { ModOneOrMore, 'g',        goto_ctag    },
+    { ModCtrl,      'n',        new_win      },
+    { ModOneOrMore, '\n',       newline      },
+    { ModCtrl,      ' ',        complete     },
     { 0, 0, 0 }
 };
 
@@ -581,7 +582,7 @@ int main(int argc, char** argv) {
     if (!ShellCmd[0]) ShellCmd[0] = getenv("SHELL");
     if (!ShellCmd[0]) ShellCmd[0] = "/bin/sh";
     /* Create the window and enter the event loop */
-    win_window("edit", ondiagmsg);
+    win_window("tide", ondiagmsg);
     char* tags = getenv("EDITTAGS");
     win_settext(TAGS, (tags ? tags : DefaultTags));
     win_setruler(RulePosition);