vis
a vi-like editor based on Plan 9's structural regular expressions
git clone https://9o.is/git/vis.git
commit 04665f8c1ccde7dfa0adcddebea8b674ddf6272f parent 5e3c2c70a5d32bfa157c4ff683f30b3ced7bad4d Author: Marc André Tanner <mat@brain-dump.org> Date: Sat, 25 Feb 2017 20:06:15 +0100 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. Diffstat:
| M | vis.c | | | 5 | +++-- |
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git 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) {