aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc André Tanner <mat@brain-dump.org>2017-02-25 20:06:15 +0100
committerMarc André Tanner <mat@brain-dump.org>2017-02-25 20:06:15 +0100
commit2f498cab6e195ab9f5e2321cffe48894560c9c38 (patch)
treec4f0c4b4abb02675fbd7d7fa5cbb5e6d5806e651
parent046819649794ff1d2fb23480cad28cc036a0743c (diff)
downloadvis-2f498cab6e195ab9f5e2321cffe48894560c9c38.tar.gz
vis-2f498cab6e195ab9f5e2321cffe48894560c9c38.tar.xz
vis: tweak handling of end inclusiveness
Only extend end of range when the motion did so too. As an example this prevents motions like `$dg_` from deleting the newline which was the starting position.
-rw-r--r--vis.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/vis.c b/vis.c
index 816a90d..1595d1e 100644
--- a/vis.c
+++ b/vis.c
@@ -759,8 +759,9 @@ void vis_do(Vis *vis) {
window_jumplist_add(win, pos);
else
window_jumplist_invalidate(win);
- } else if (a->movement->type & INCLUSIVE ||
- (linewise && a->movement->type & LINEWISE_INCLUSIVE)) {
+ } else if (a->movement->type & INCLUSIVE && c.range.end > start) {
+ c.range.end = text_char_next(txt, c.range.end);
+ } else if (linewise && (a->movement->type & LINEWISE_INCLUSIVE)) {
c.range.end = text_char_next(txt, c.range.end);
}
} else if (a->textobj) {