diff options
| author | Marc André Tanner <mat@brain-dump.org> | 2017-07-06 21:28:51 +0200 |
|---|---|---|
| committer | Marc André Tanner <mat@brain-dump.org> | 2017-07-07 23:48:58 +0200 |
| commit | 5c600e15c1c1ab64f385de918c93d2bdb23955d5 (patch) | |
| tree | d89f5d640d67ca98db0c19dd465532e0eeba65a2 /vis-motions.c | |
| parent | 90df6338354b621828f2fae257380d766406b4a4 (diff) | |
| download | vis-5c600e15c1c1ab64f385de918c93d2bdb23955d5.tar.gz vis-5c600e15c1c1ab64f385de918c93d2bdb23955d5.tar.xz | |
vis: use marks instead of registers to store selections
The key binding remain the same, but the selections are now stored on
a per-buffer basis.
Diffstat (limited to 'vis-motions.c')
| -rw-r--r-- | vis-motions.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/vis-motions.c b/vis-motions.c index 9917ce5..b07585b 100644 --- a/vis-motions.c +++ b/vis-motions.c @@ -107,12 +107,17 @@ static size_t longword_next(Vis *vis, Text *txt, size_t pos) { return common_word_next(vis, txt, pos, VIS_MOVE_LONGWORD_END_NEXT); } -static size_t mark_goto(Vis *vis, File *file, size_t pos) { - return text_mark_get(file->text, file->marks[vis->action.mark]); +static size_t mark_goto(Vis *vis, File *file, Selection *sel) { + Array *marks = &file->marks[vis->action.mark]; + size_t idx = view_selections_number(sel); + SelectionRegion *sr = array_get(marks, idx); + if (!sr) + return EPOS; + return text_mark_get(file->text, sr->cursor); } -static size_t mark_line_goto(Vis *vis, File *file, size_t pos) { - return text_line_start(file->text, mark_goto(vis, file, pos)); +static size_t mark_line_goto(Vis *vis, File *file, Selection *sel) { + return text_line_start(file->text, mark_goto(vis, file, sel)); } static size_t to(Vis *vis, Text *txt, size_t pos) { |
