Skip to content

Commit

Permalink
vis: process aliased key sequences individually
Browse files Browse the repository at this point in the history
While the complete alias is added to the input queue,
the called key bindings should only see the keys they
have asked for.

Previously a mapping such as:

 :map! normal gv \"^Sv

did not work as expected because the key binding for
the register did reject an invalid multi letter register
name.

Might also influence martanne#581
  • Loading branch information
martanne committed Jul 3, 2017
1 parent 7f3d570 commit 54ca598
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions vis.c
Original file line number Diff line number Diff line change
Expand Up @@ -1185,12 +1185,22 @@ static void vis_keys_process(Vis *vis, size_t pos) {
strcpy(vis->key_prev, vis->key_current);
strncpy(vis->key_current, start, len);
vis->key_current[len] = '\0';
end = (char*)binding->action->func(vis, binding_end, &binding->action->arg);
char *params_end = binding_end;
while (params_end) {
tmp = *params_end;
*params_end = '\0';
end = (char*)binding->action->func(vis, binding_end, &binding->action->arg);
*params_end = tmp;
if (end) {
start = cur = end;
break;
}
params_end = (char*)vis_keys_next(vis, params_end);
}
if (!end) {
end = start;
break;
}
start = cur = end;
} else if (binding->alias) {
buffer_remove(buf, start - buf->data, binding_end - start);
buffer_insert0(buf, start - buf->data, binding->alias);
Expand Down

0 comments on commit 54ca598

Please sign in to comment.