aboutsummaryrefslogtreecommitdiff
path: root/vis.c
diff options
context:
space:
mode:
authorMarc André Tanner <mat@brain-dump.org>2015-10-26 19:36:49 +0100
committerMarc André Tanner <mat@brain-dump.org>2015-10-26 19:36:49 +0100
commitd8d0bb600c7984e23b95b7fdbfe59743b388a75c (patch)
treeef63472c4e52a01255c5f3a107e9a40fb5970c7f /vis.c
parent12fd7c278abee067c6c52e709e3cebbfc9ca04bf (diff)
downloadvis-d8d0bb600c7984e23b95b7fdbfe59743b388a75c.tar.gz
vis-d8d0bb600c7984e23b95b7fdbfe59743b388a75c.tar.xz
vis: introduce explicit operators for cursor creation
Diffstat (limited to 'vis.c')
-rw-r--r--vis.c9
1 files changed, 7 insertions, 2 deletions
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;
}