diff options
| author | Marc André Tanner <mat@brain-dump.org> | 2016-01-19 13:18:20 +0100 |
|---|---|---|
| committer | Marc André Tanner <mat@brain-dump.org> | 2016-01-19 13:18:20 +0100 |
| commit | a83ab01a6c3a4153d2c7bae60f8975a39d7955ca (patch) | |
| tree | 4bbb346d62733444818b4f75630b2f1940115bb1 /main.c | |
| parent | 48ce013f1df470b340908f02d4ea87c812f902f7 (diff) | |
| download | vis-a83ab01a6c3a4153d2c7bae60f8975a39d7955ca.tar.gz vis-a83ab01a6c3a4153d2c7bae60f8975a39d7955ca.tar.xz | |
vis: improve selection restore `gv`
Diffstat (limited to 'main.c')
| -rw-r--r-- | main.c | 10 |
1 files changed, 8 insertions, 2 deletions
@@ -1280,9 +1280,15 @@ static const char *selection_end(Vis *vis, const char *keys, const Arg *arg) { } static const char *selection_restore(Vis *vis, const char *keys, const Arg *arg) { - for (Cursor *c = view_cursors(vis_view(vis)); c; c = view_cursors_next(c)) + Text *txt = vis_text(vis); + View *view = vis_view(vis); + for (Cursor *c = view_cursors(view); c; c = view_cursors_next(c)) view_cursors_selection_restore(c); - vis_mode_switch(vis, VIS_MODE_VISUAL); + Filerange sel = view_selection_get(view); + if (text_range_is_linewise(txt, &sel)) + vis_mode_switch(vis, VIS_MODE_VISUAL_LINE); + else + vis_mode_switch(vis, VIS_MODE_VISUAL); return keys; } |
