From 620518966fb99511c506af292cc1885f7a419881 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Andr=C3=A9=20Tanner?= Date: Mon, 27 Jul 2015 21:04:20 +0200 Subject: vis: add per cursor registers --- vis.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'vis.c') 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, }; -- cgit v1.2.3