From 2f498cab6e195ab9f5e2321cffe48894560c9c38 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Andr=C3=A9=20Tanner?= Date: Sat, 25 Feb 2017 20:06:15 +0100 Subject: 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. --- vis.c | 5 +++-- 1 file 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) { -- cgit v1.2.3