vis
a vi-like editor based on Plan 9's structural regular expressions
git clone https://9o.is/git/vis.git
commit 177b856d4bb1e3ca3accc3930f1cdbe781638568 parent 2b79410f7a99c3ff960190c52884816c9f2d4163 Author: Marc André Tanner <mat@brain-dump.org> Date: Mon, 22 Dec 2014 15:07:27 +0100 Move kepress hook to record all keys Diffstat:
| M | vis.c | | | 7 | ++++--- |
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/vis.c b/vis.c @@ -1732,8 +1732,6 @@ static void keypress(Key *key) { static KeyCombo keys; static int keylen; - if (config->keypress && !config->keypress(key)) - return; keys[keylen++] = *key; KeyBinding *action = keybinding(mode, keys); @@ -1759,7 +1757,7 @@ static void keypress(Key *key) { } static Key getkey(void) { - Key key = { .str = "\0\0\0\0\0\0", .code = 0 }; + Key key = { .str = "", .code = 0 }; int keycode = getch(), len = 0; if (keycode == ERR) return key; @@ -1778,6 +1776,9 @@ static Key getkey(void) { } } + if (config->keypress && !config->keypress(&key)) + return (Key){ .str = "", .code = 0 }; + return key; }