vis
a vi-like editor based on Plan 9's structural regular expressions
git clone https://9o.is/git/vis.git
commit 898f78523331bebe6051eeb3a5e9374a898cd50f parent 86dd427491d1dcb698e3151351739098e3a40bd7 Author: Marc André Tanner <mat@brain-dump.org> Date: Sat, 20 Feb 2016 17:59:44 +0100 vis: reject obviously recursive key bindings This does only detect the simplest cases. Diffstat:
| M | vis-modes.c | | | 3 | +++ |
1 file changed, 3 insertions(+), 0 deletions(-)
diff --git 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)