aboutsummaryrefslogtreecommitdiff
path: root/vis.c
diff options
context:
space:
mode:
authorMarc André Tanner <mat@brain-dump.org>2016-11-09 11:58:29 +0100
committerMarc André Tanner <mat@brain-dump.org>2016-11-09 12:34:55 +0100
commit51bf6abad037a333ad3b8f760150de4d834bb900 (patch)
treec2c8d9e5fc4d6f76c310202dfc096ca98f375084 /vis.c
parent0e74ee26ef3d441a559ea18bec08018c0c2ef461 (diff)
downloadvis-51bf6abad037a333ad3b8f760150de4d834bb900.tar.gz
vis-51bf6abad037a333ad3b8f760150de4d834bb900.tar.xz
vis: unify VIS_OP_{INSERT,REPLACE} implementation
They both perform a motion before changing mode.
Diffstat (limited to 'vis.c')
-rw-r--r--vis.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/vis.c b/vis.c
index b1f0a31..d48e857 100644
--- a/vis.c
+++ b/vis.c
@@ -704,10 +704,10 @@ void vis_do(Vis *vis) {
/* operator implementations must not change the mode,
* they might get called multiple times (once for every cursor)
*/
- if (a->op == &vis_operators[VIS_OP_INSERT] || a->op == &vis_operators[VIS_OP_CHANGE]) {
+ if (a->op == &vis_operators[VIS_OP_CHANGE]) {
vis_mode_switch(vis, VIS_MODE_INSERT);
- } else if (a->op == &vis_operators[VIS_OP_REPLACE]) {
- vis_mode_switch(vis, VIS_MODE_REPLACE);
+ } else if (a->op == &vis_operators[VIS_OP_MODESWITCH]) {
+ vis_mode_switch(vis, a->mode);
} else if (a->op == &vis_operators[VIS_OP_FILTER]) {
if (a->arg.s)
vis_cmd(vis, a->arg.s);
@@ -1127,7 +1127,7 @@ void vis_repeat(Vis *vis) {
vis->action_prev.count = count;
count = vis->action_prev.count;
/* for some operators count should be applied only to the macro not the motion */
- if (vis->action_prev.op == &vis_operators[VIS_OP_INSERT] || vis->action_prev.op == &vis_operators[VIS_OP_REPLACE])
+ if (vis->action_prev.op == &vis_operators[VIS_OP_MODESWITCH])
vis->action_prev.count = 1;
vis->action = vis->action_prev;
vis_do(vis);