diff options
| author | Marc André Tanner <mat@brain-dump.org> | 2016-02-20 17:59:44 +0100 |
|---|---|---|
| committer | Marc André Tanner <mat@brain-dump.org> | 2016-02-20 18:07:12 +0100 |
| commit | 40a6aedd7a2da02c42e72c636493c27059696947 (patch) | |
| tree | 7553c1b0f554ac3235b1be075265b0be89c9ec0a /vis-modes.c | |
| parent | 0dcdc85d9bd5ed67468d27607bd7debd01f8853a (diff) | |
| download | vis-40a6aedd7a2da02c42e72c636493c27059696947.tar.gz vis-40a6aedd7a2da02c42e72c636493c27059696947.tar.xz | |
vis: reject obviously recursive key bindings
This does only detect the simplest cases.
Diffstat (limited to 'vis-modes.c')
| -rw-r--r-- | vis-modes.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/vis-modes.c b/vis-modes.c index f519b5b..177b034 100644 --- a/vis-modes.c +++ b/vis-modes.c @@ -1,3 +1,4 @@ +#include <string.h> #include "vis-core.h" #include "util.h" @@ -27,6 +28,8 @@ void vis_mode_switch(Vis *vis, enum VisMode mode) { static bool mode_map(Mode *mode, const char *key, const KeyBinding *binding) { if (!mode) return false; + if (binding->alias && key[0] != '<' && strncmp(key, binding->alias, strlen(key)) == 0) + return false; if (!mode->bindings) { mode->bindings = map_new(); if (!mode->bindings) |
