diff options
| author | Marc André Tanner <mat@brain-dump.org> | 2015-10-26 19:26:05 +0100 |
|---|---|---|
| committer | Marc André Tanner <mat@brain-dump.org> | 2015-10-26 19:30:12 +0100 |
| commit | 12fd7c278abee067c6c52e709e3cebbfc9ca04bf (patch) | |
| tree | 5fd0a6af1c4939431ebda4fee5427cc0cfcf42c9 /main.c | |
| parent | 7bf93d00b0e40e0ba5b9c45e3be43985555c3f6c (diff) | |
| download | vis-12fd7c278abee067c6c52e709e3cebbfc9ca04bf.tar.gz vis-12fd7c278abee067c6c52e709e3cebbfc9ca04bf.tar.xz | |
vis: introduce explicit operators for case changes
Diffstat (limited to 'main.c')
| -rw-r--r-- | main.c | 14 |
1 files changed, 3 insertions, 11 deletions
@@ -69,8 +69,6 @@ static const char *gotoline(Vis*, const char *keys, const Arg *arg); static const char *motiontype(Vis*, const char *keys, const Arg *arg); /* make the current action use the operator indicated by arg->i */ static const char *operator(Vis*, const char *keys, const Arg *arg); -/* change case of a file range to upper (arg->i > 0) or lowercase (arg->i < 0) */ -static const char *changecase(Vis*, const char *keys, const Arg *arg); /* blocks to read a key and performs movement indicated by arg->i which * should be one of MOVE_{RIGHT,LEFT}_{TO,TILL} */ static const char *movement_key(Vis*, const char *keys, const Arg *arg); @@ -697,17 +695,17 @@ static KeyAction vis_action[] = { [VIS_ACTION_OPERATOR_CASE_LOWER] = { "vis-operator-case-lower", "Lowercase operator", - changecase, { .i = -1 } + operator, { .i = OP_CASE_LOWER } }, [VIS_ACTION_OPERATOR_CASE_UPPER] = { "vis-operator-case-upper", "Uppercase operator", - changecase, { .i = +1 } + operator, { .i = OP_CASE_UPPER } }, [VIS_ACTION_OPERATOR_CASE_SWAP] = { "vis-operator-case-swap", "Swap case operator", - changecase, { .i = 0 } + operator, { .i = OP_CASE_SWAP } }, [VIS_ACTION_COUNT] = { "vis-count", @@ -1237,12 +1235,6 @@ static const char *operator(Vis *vis, const char *keys, const Arg *arg) { return keys; } -static const char *changecase(Vis *vis, const char *keys, const Arg *arg) { - vis->action.arg = *arg; - vis_operator(vis, OP_CASE_CHANGE); - return keys; -} - static const char *movement_key(Vis *vis, const char *keys, const Arg *arg) { if (!keys[0]) return NULL; |
