aboutsummaryrefslogtreecommitdiff
path: root/vis-modes.c
diff options
context:
space:
mode:
authorMarc André Tanner <mat@brain-dump.org>2016-04-28 20:52:31 +0200
committerMarc André Tanner <mat@brain-dump.org>2016-04-28 22:00:08 +0200
commit53e3c9cac64bc537963fe12816e905c9726c3cdf (patch)
tree1c4cf7f5fd16a0200461449dc15b1cfa703201df /vis-modes.c
parenteb1e37f0732654d3d1965f1487115e3c5d8a3f59 (diff)
downloadvis-53e3c9cac64bc537963fe12816e905c9726c3cdf.tar.gz
vis-53e3c9cac64bc537963fe12816e905c9726c3cdf.tar.xz
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 (limited to 'vis-modes.c')
-rw-r--r--vis-modes.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/vis-modes.c b/vis-modes.c
index b44212f..62a9541 100644
--- 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) {