diff options
| author | Marc André Tanner <mat@brain-dump.org> | 2015-07-27 21:04:20 +0200 |
|---|---|---|
| committer | Marc André Tanner <mat@brain-dump.org> | 2015-07-28 13:21:50 +0200 |
| commit | 620518966fb99511c506af292cc1885f7a419881 (patch) | |
| tree | a3ae882163f2837bd4b55a5a67dc46b0c6fbf731 /vis.c | |
| parent | c9499ddd97d1bb8395e896050e92c6eee7e4b205 (diff) | |
| download | vis-620518966fb99511c506af292cc1885f7a419881.tar.gz vis-620518966fb99511c506af292cc1885f7a419881.tar.xz | |
vis: add per cursor registers
Diffstat (limited to 'vis.c')
| -rw-r--r-- | vis.c | 10 |
1 files changed, 8 insertions, 2 deletions
@@ -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, }; |
