From d8d0bb600c7984e23b95b7fdbfe59743b388a75c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Andr=C3=A9=20Tanner?= Date: Mon, 26 Oct 2015 19:36:49 +0100 Subject: vis: introduce explicit operators for cursor creation --- main.c | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) (limited to 'main.c') diff --git a/main.c b/main.c index 40de71b..6a2e593 100644 --- a/main.c +++ b/main.c @@ -45,9 +45,6 @@ static const char *repeat(Vis*, const char *keys, const Arg *arg); static const char *replace(Vis*, const char *keys, const Arg *arg); /* create a new cursor on the previous (arg->i < 0) or next (arg->i > 0) line */ static const char *cursors_new(Vis*, const char *keys, const Arg *arg); -/* create new cursors in visual mode either at the start (arg-i < 0) - * or end (arg->i > 0) of the selected lines */ -static const char *cursors_split(Vis*, const char *keys, const Arg *arg); /* try to align all cursors on the same column */ static const char *cursors_align(Vis*, const char *keys, const Arg *arg); /* remove all but the primary cursor and their selections */ @@ -860,12 +857,12 @@ static KeyAction vis_action[] = { [VIS_ACTION_CURSORS_NEW_LINES_BEGIN] = { "cursors-new-lines-begin", "Create a new cursor at the start of every line covered by selection", - cursors_split, { .i = -1 } + operator, { .i = OP_CURSOR_SOL } }, [VIS_ACTION_CURSORS_NEW_LINES_END] = { "cursors-new-lines-end", "Create a new cursor at the end of every line covered by selection", - cursors_split, { .i = +1 } + operator, { .i = OP_CURSOR_EOL } }, [VIS_ACTION_CURSORS_NEW_MATCH_NEXT] = { "cursors-new-match-next", @@ -1099,12 +1096,6 @@ static const char *cursors_new(Vis *vis, const char *keys, const Arg *arg) { return keys; } -static const char *cursors_split(Vis *vis, const char *keys, const Arg *arg) { - vis->action.arg = *arg; - vis_operator(vis, OP_CURSOR); - return keys; -} - static const char *cursors_align(Vis *vis, const char *keys, const Arg *arg) { View *view = vis->win->view; Text *txt = vis->win->file->text; -- cgit v1.2.3