diff options
| author | Marc André Tanner <mat@brain-dump.org> | 2015-10-22 21:28:21 +0200 |
|---|---|---|
| committer | Marc André Tanner <mat@brain-dump.org> | 2015-10-22 21:28:21 +0200 |
| commit | 4d072a37d75b3d26425fcc4b5cfcf1d67bab0658 (patch) | |
| tree | d0c35c6570748efb2083d6481817e61e2ab4305e | |
| parent | 78fa73b61c0fd071cccbdee548f1220cf69368c6 (diff) | |
| download | vis-4d072a37d75b3d26425fcc4b5cfcf1d67bab0658.tar.gz vis-4d072a37d75b3d26425fcc4b5cfcf1d67bab0658.tar.xz | |
vis: remove global state from key input handling
| -rw-r--r-- | config.def.h | 10 | ||||
| -rw-r--r-- | vis.c | 11 |
2 files changed, 7 insertions, 14 deletions
diff --git a/config.def.h b/config.def.h index e3f8e92..9ba2e5b 100644 --- a/config.def.h +++ b/config.def.h @@ -57,15 +57,6 @@ static Command cmds[] = { { /* array terminator */ }, }; -/* called before any other keybindings are checked, if the function returns false - * the key is completely ignored. */ -static bool vis_keypress(const char *key) { - editor_info_hide(vis); - if (vis->recording && key) - macro_append(vis->recording, key); - return true; -} - #define ALIAS(name) .alias = name, #define ACTION(id) .action = &vis_action[VIS_ACTION_##id], @@ -1528,7 +1519,6 @@ static Config editors[] = { { .name = "vis", .mode = &vis_modes[VIS_MODE_NORMAL], - .keypress = vis_keypress, }, }; @@ -467,7 +467,7 @@ static bool vis_window_split(Win *win); #include "config.h" -static const char *getkey(void); +static const char *getkey(Vis*); static const char *keynext(Vis*, const char *keys); static const char *keypress(Vis*, const char *key); static void action_do(Vis*, Action *a); @@ -2712,10 +2712,13 @@ static const char *keypress(Vis *vis, const char *input) { return input + (start - keys); } -static const char *getkey(void) { +static const char *getkey(Vis *vis) { const char *key = vis->ui->getkey(vis->ui); - if (!key || (config->keypress && !config->keypress(key))) + if (!key) return NULL; + editor_info_hide(vis); + if (vis->recording) + macro_append(vis->recording, key); return key; } @@ -2792,7 +2795,7 @@ static void mainloop(Vis *vis) { termkey_advisereadable(termkey); const char *key; - while ((key = getkey())) + while ((key = getkey(vis))) keypress(vis, key); if (vis->mode->idle) |
