aboutsummaryrefslogtreecommitdiff
path: root/main.c
diff options
context:
space:
mode:
authorMarc André Tanner <mat@brain-dump.org>2014-09-04 22:44:53 +0200
committerMarc André Tanner <mat@brain-dump.org>2014-09-04 22:44:53 +0200
commitbf60ce7d75949a8d6d53473d3b2430c162f5f897 (patch)
tree0ade285ba44ee4b0a705898619a5658102a967dd /main.c
parent33812921a2294637e4635d5b8426fc47f69a05a5 (diff)
downloadvis-bf60ce7d75949a8d6d53473d3b2430c162f5f897.tar.gz
vis-bf60ce7d75949a8d6d53473d3b2430c162f5f897.tar.xz
Skip modes with common prefix if it does not match
Diffstat (limited to 'main.c')
-rw-r--r--main.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/main.c b/main.c
index d1c0b07..5e7240e 100644
--- a/main.c
+++ b/main.c
@@ -103,6 +103,8 @@ static bool keymatch(Key *key0, Key *key1) {
static KeyBinding *keybinding(Mode *mode, Key *key0, Key *key1) {
for (; mode; mode = mode->parent) {
+ if (mode->common_prefix && !keymatch(key0, &mode->bindings->key[0]))
+ continue;
for (KeyBinding *kb = mode->bindings; kb && (kb->key[0].code || kb->key[0].str[0]); kb++) {
if (keymatch(key0, &kb->key[0]) && (!key1 || keymatch(key1, &kb->key[1])))
return kb;