diff options
| author | Marc André Tanner <mat@brain-dump.org> | 2017-02-07 08:54:23 +0100 |
|---|---|---|
| committer | Marc André Tanner <mat@brain-dump.org> | 2017-02-07 11:31:34 +0100 |
| commit | d68217c61f9c5d7bf79d3efa440a93f2761a3975 (patch) | |
| tree | d32637eb0c4aa05d0218b27d5ebf1c17b079f77f /vis.c | |
| parent | b01ac103aa61b5a0383ed085bf6997d8e5f70bbc (diff) | |
| download | vis-d68217c61f9c5d7bf79d3efa440a93f2761a3975.tar.gz vis-d68217c61f9c5d7bf79d3efa440a93f2761a3975.tar.xz | |
vis: improve text object handling
Fix `gN` and delimited inner variants when given a count.
Diffstat (limited to 'vis.c')
| -rw-r--r-- | vis.c | 15 |
1 files changed, 12 insertions, 3 deletions
@@ -776,13 +776,22 @@ void vis_do(Vis *vis) { r.end++; } - if (vis->mode->visual) + if (vis->mode->visual || (i > 0 && !(a->textobj->type & TEXTOBJECT_NON_CONTIGUOUS))) c.range = text_range_union(&c.range, &r); else c.range = r; - if (i < count - 1) - pos = c.range.end + 1; + if (i < count - 1) { + if (a->textobj->type & TEXTOBJECT_EXTEND_BACKWARD) { + pos = c.range.start; + if ((a->textobj->type & TEXTOBJECT_DELIMITED_INNER) && pos > 0) + pos--; + } else { + pos = c.range.end; + if (a->textobj->type & TEXTOBJECT_DELIMITED_INNER) + pos++; + } + } } } else if (vis->mode->visual) { c.range = view_cursors_selection_get(cursor); |
