vis
a vi-like editor based on Plan 9's structural regular expressions
git clone https://9o.is/git/vis.git
commit 31fe90ed95be12791d5aae4f5a5f3052a82b3883 parent 56bd89579c6148b89bae9ef76562eac7a9f79f06 Author: Marc André Tanner <mat@brain-dump.org> Date: Tue, 31 Jan 2017 18:14:36 +0100 vis: improve cursor positioning after operators in visual mode Make sure the selection setting code (used to restore selections) does not move the cursor. Fix #479 Diffstat:
| M | vis.c | | | 4 | ++++ |
1 file changed, 4 insertions(+), 0 deletions(-)
diff --git a/vis.c b/vis.c @@ -819,6 +819,10 @@ void vis_do(Vis *vis) { sel = text_range_new(c.range.start, sel.start); if (vis->mode == &vis_modes[VIS_MODE_VISUAL_LINE]) sel = text_range_linewise(txt, &sel); + if (!text_range_contains(&sel, pos)) { + Filerange cur = text_range_new(pos, pos); + sel = text_range_union(&sel, &cur); + } view_cursors_selection_set(cursor, &sel); } }