diff options
| author | Marc André Tanner <mat@brain-dump.org> | 2016-01-20 12:53:33 +0100 |
|---|---|---|
| committer | Marc André Tanner <mat@brain-dump.org> | 2016-01-20 12:53:33 +0100 |
| commit | a552b071a0f88153ba5ff462fcdf4461ff4f2a16 (patch) | |
| tree | b860b85d18e031314426bf7defeaa9082736cc82 | |
| parent | 0d4093c3371079c5f75055338f0341f684542465 (diff) | |
| download | vis-a552b071a0f88153ba5ff462fcdf4461ff4f2a16.tar.gz vis-a552b071a0f88153ba5ff462fcdf4461ff4f2a16.tar.xz | |
vis: further improve selection restore code
This is still not 100% correct for all possible cases, but
should work for those currently used by vis e.g. the shift
left operator.
| -rw-r--r-- | vis.c | 6 |
1 files changed, 6 insertions, 0 deletions
@@ -527,6 +527,12 @@ void action_do(Vis *vis, Action *a) { Filerange sel = view_cursors_selection_get(cursor); view_cursors_to(cursor, pos); if (vis->mode->visual) { + if (sel.start == EPOS && sel.end == EPOS) + sel = c.range; + else if (sel.start == EPOS) + sel = text_range_new(c.range.start, sel.end); + else if (sel.end == EPOS) + sel = text_range_new(c.range.start, sel.start); if (vis->mode == &vis_modes[VIS_MODE_VISUAL_LINE]) sel = text_range_linewise(txt, &sel); view_cursors_selection_set(cursor, &sel); |
