diff options
| author | Marc André Tanner <mat@brain-dump.org> | 2016-11-09 11:58:29 +0100 |
|---|---|---|
| committer | Marc André Tanner <mat@brain-dump.org> | 2016-11-09 12:34:55 +0100 |
| commit | 51bf6abad037a333ad3b8f760150de4d834bb900 (patch) | |
| tree | c2c8d9e5fc4d6f76c310202dfc096ca98f375084 /vis-operators.c | |
| parent | 0e74ee26ef3d441a559ea18bec08018c0c2ef461 (diff) | |
| download | vis-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-operators.c')
| -rw-r--r-- | vis-operators.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/vis-operators.c b/vis-operators.c index 3ce7689..5784115 100644 --- a/vis-operators.c +++ b/vis-operators.c @@ -214,11 +214,7 @@ static size_t op_join(Vis *vis, Text *txt, OperatorContext *c) { return newpos != EPOS ? newpos : c->range.start; } -static size_t op_insert(Vis *vis, Text *txt, OperatorContext *c) { - return c->newpos != EPOS ? c->newpos : c->pos; -} - -static size_t op_replace(Vis *vis, Text *txt, OperatorContext *c) { +static size_t op_modeswitch(Vis *vis, Text *txt, OperatorContext *c) { return c->newpos != EPOS ? c->newpos : c->pos; } @@ -231,6 +227,9 @@ bool vis_operator(Vis *vis, enum VisOperator id, ...) { va_start(ap, id); switch (id) { + case VIS_OP_MODESWITCH: + vis->action.mode = va_arg(ap, int); + break; case VIS_OP_CASE_LOWER: case VIS_OP_CASE_UPPER: case VIS_OP_CASE_SWAP: @@ -304,8 +303,7 @@ const Operator vis_operators[] = { [VIS_OP_SHIFT_LEFT] = { op_shift_left }, [VIS_OP_CASE_SWAP] = { op_case_change }, [VIS_OP_JOIN] = { op_join }, - [VIS_OP_INSERT] = { op_insert }, - [VIS_OP_REPLACE] = { op_replace }, + [VIS_OP_MODESWITCH] = { op_modeswitch }, [VIS_OP_CURSOR_SOL] = { op_cursor }, [VIS_OP_FILTER] = { op_filter }, }; |
