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 --- vis.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'vis.c') diff --git a/vis.c b/vis.c index 134b332..8265182 100644 --- a/vis.c +++ b/vis.c @@ -576,7 +576,7 @@ static Operator ops[] = { [OP_JOIN] = { op_join }, [OP_REPEAT_INSERT] = { op_repeat_insert }, [OP_REPEAT_REPLACE] = { op_repeat_replace }, - [OP_CURSOR] = { op_cursor }, + [OP_CURSOR_SOL] = { op_cursor }, }; /** movements which can be used besides the one in text-motions.h and view.h */ @@ -1170,7 +1170,7 @@ static size_t op_cursor(Vis *vis, Text *txt, OperatorContext *c) { Cursor *cursor = view_cursors_new(view); if (cursor) { size_t pos; - if (c->arg->i > 0) + if (c->arg->i == OP_CURSOR_EOL) pos = text_line_finish(txt, line); else pos = text_line_start(txt, line); @@ -2808,6 +2808,11 @@ bool vis_operator(Vis *vis, enum VisOperator id) { vis->action.arg.i = id; id = OP_CASE_SWAP; break; + case OP_CURSOR_SOL: + case OP_CURSOR_EOL: + vis->action.arg.i = id; + id = OP_CURSOR_SOL; + break; default: break; } -- cgit v1.2.3