vis

a vi-like editor based on Plan 9's structural regular expressions

git clone https://9o.is/git/vis.git

commit f2d6d6c03f3a074de63df1aaf3c2c5ae67117b1b
parent 9e3c8e4676d5cfb7a3d5d757d09ba8812aab58cf
Author: Marc André Tanner <mat@brain-dump.org>
Date:   Thu, 28 Apr 2016 20:52:31 +0200

vis: reject key mappings for which a prefix is already mapped

`<` needs a special treatment because it is used to denote symbolic
keys without it the shift left operator would not work.

Diffstat:
Mvis-modes.c | 2+-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/vis-modes.c b/vis-modes.c @@ -35,7 +35,7 @@ static bool mode_map(Mode *mode, const char *key, const KeyBinding *binding) { if (!mode->bindings) return false; } - return map_put(mode->bindings, key, binding); + return (strcmp(key, "<") == 0 || !map_contains(mode->bindings, key)) && map_put(mode->bindings, key, binding); } bool vis_mode_map(Vis *vis, enum VisMode id, const char *key, const KeyBinding *binding) {