aboutsummaryrefslogtreecommitdiff
path: root/vis.c
diff options
context:
space:
mode:
authorMarc André Tanner <mat@brain-dump.org>2016-12-17 10:41:20 +0100
committerMarc André Tanner <mat@brain-dump.org>2016-12-17 10:57:20 +0100
commit19c4f8aa853bca99da406dab96b09ca85a29dbcd (patch)
tree9ee04d70e9b4eb89f3a9094f19551b62ff7e0532 /vis.c
parent048126ed524e7e5df9ecb611336602aec8d25522 (diff)
downloadvis-19c4f8aa853bca99da406dab96b09ca85a29dbcd.tar.gz
vis-19c4f8aa853bca99da406dab96b09ca85a29dbcd.tar.xz
vis: always remove consumed keys from input queue
When given a mapping like: :map! insert >> ><>x> whose end is a prefix of another mapping we should still remove all already consumed keys from the input queue. Fixes #436
Diffstat (limited to 'vis.c')
-rw-r--r--vis.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/vis.c b/vis.c
index 2d9c4e8..1926d62 100644
--- a/vis.c
+++ b/vis.c
@@ -909,10 +909,11 @@ static void vis_keys_process(Vis *vis, size_t pos) {
} else if (binding->alias) {
buffer_remove(buf, start - buf->data, end - start);
buffer_insert0(buf, start - buf->data, binding->alias);
- cur = start;
+ cur = end = start;
}
} else if (prefix) { /* incomplete key binding? */
cur = end;
+ end = start;
} else { /* no keybinding */
KeyAction *action = NULL;
if (start[0] == '<' && end[-1] == '>') {
@@ -937,8 +938,7 @@ static void vis_keys_process(Vis *vis, size_t pos) {
}
}
- if (!prefix)
- buffer_remove(buf, keys - buf->data, end - keys);
+ buffer_remove(buf, keys - buf->data, end - keys);
}
void vis_keys_feed(Vis *vis, const char *input) {