diff options
| author | Marc André Tanner <mat@brain-dump.org> | 2017-01-31 18:14:36 +0100 |
|---|---|---|
| committer | Marc André Tanner <mat@brain-dump.org> | 2017-01-31 18:14:36 +0100 |
| commit | 2ac88768ec2a643fe4a91f1bcde476fb5ec662c8 (patch) | |
| tree | a2dc5ba65767950ab4e22aa3731b29b40d203c73 | |
| parent | ef21a35b0797ab272010d86456614458a7667d24 (diff) | |
| download | vis-2ac88768ec2a643fe4a91f1bcde476fb5ec662c8.tar.gz vis-2ac88768ec2a643fe4a91f1bcde476fb5ec662c8.tar.xz | |
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
| -rw-r--r-- | vis.c | 4 |
1 files changed, 4 insertions, 0 deletions
@@ -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); } } |
