aboutsummaryrefslogtreecommitdiff
path: root/vis.c
diff options
context:
space:
mode:
authorMarc André Tanner <mat@brain-dump.org>2015-07-27 21:04:20 +0200
committerMarc André Tanner <mat@brain-dump.org>2015-07-28 13:21:50 +0200
commit620518966fb99511c506af292cc1885f7a419881 (patch)
treea3ae882163f2837bd4b55a5a67dc46b0c6fbf731 /vis.c
parentc9499ddd97d1bb8395e896050e92c6eee7e4b205 (diff)
downloadvis-620518966fb99511c506af292cc1885f7a419881.tar.gz
vis-620518966fb99511c506af292cc1885f7a419881.tar.xz
vis: add per cursor registers
Diffstat (limited to 'vis.c')
-rw-r--r--vis.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/vis.c b/vis.c
index 9ca92cd..d11c696 100644
--- a/vis.c
+++ b/vis.c
@@ -1227,16 +1227,22 @@ static void action_do(Action *a) {
Text *txt = vis->win->file->text;
View *view = vis->win->view;
int count = MAX(1, a->count);
+ Cursor *cursor = view_cursors(view), *next;
+ bool multiple_cursors = cursor && view_cursors_next(cursor);
- for (Cursor *cursor = view_cursors(view), *next; cursor; cursor = next) {
+ for (; cursor; cursor = next) {
next = view_cursors_next(cursor);
size_t pos = view_cursors_pos(cursor);
+ Register *reg = a->reg ? a->reg : &vis->registers[REG_DEFAULT];
+ if (multiple_cursors)
+ reg = view_cursors_register(cursor);
+
OperatorContext c = {
.count = a->count,
.pos = pos,
.range = text_range_empty(),
- .reg = a->reg ? a->reg : &vis->registers[REG_DEFAULT],
+ .reg = reg,
.linewise = a->linewise,
.arg = &a->arg,
};