diff options
| author | Marc André Tanner <mat@brain-dump.org> | 2016-02-11 10:03:14 +0100 |
|---|---|---|
| committer | Marc André Tanner <mat@brain-dump.org> | 2016-02-11 10:03:14 +0100 |
| commit | 979d51bcb65ccceec95f34a10fdf6446ac97473c (patch) | |
| tree | d06e2b6ed680a5f5a8279afc5fde58dc5a9f7037 /vis.c | |
| parent | 534000b7831a6b536353053e47d582cf6c7f3053 (diff) | |
| download | vis-979d51bcb65ccceec95f34a10fdf6446ac97473c.tar.gz vis-979d51bcb65ccceec95f34a10fdf6446ac97473c.tar.xz | |
vis: add support for different kind of text objects
Up until now text objects would only ever grow/expand if
applied multiple times. The new SPLIT type allows text
objects which cover a completely different range when
applied with a count.
Diffstat (limited to 'vis.c')
| -rw-r--r-- | vis.c | 13 |
1 files changed, 10 insertions, 3 deletions
@@ -503,15 +503,22 @@ void action_do(Vis *vis, Action *a) { else c.range.start = c.range.end = pos; for (int i = 0; i < count; i++) { - Filerange r = a->textobj->range(txt, pos); + Filerange r; + if (a->textobj->txt) + r = a->textobj->txt(txt, pos); + else + r = a->textobj->vis(vis, txt, pos); if (!text_range_valid(&r)) break; - if (a->textobj->type == OUTER) { + if (a->textobj->type & OUTER) { r.start--; r.end++; } - c.range = text_range_union(&c.range, &r); + if (a->textobj->type & SPLIT) + c.range = r; + else + c.range = text_range_union(&c.range, &r); if (i < count - 1) pos = c.range.end + 1; |
