From 12fd7c278abee067c6c52e709e3cebbfc9ca04bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Andr=C3=A9=20Tanner?= Date: Mon, 26 Oct 2015 19:26:05 +0100 Subject: vis: introduce explicit operators for case changes --- main.c | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) (limited to 'main.c') diff --git a/main.c b/main.c index 9be0525..40de71b 100644 --- a/main.c +++ b/main.c @@ -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; -- cgit v1.2.3