summaryrefslogtreecommitdiff
path: root/vis-motions.c
diff options
context:
space:
mode:
Diffstat (limited to 'vis-motions.c')
-rw-r--r--vis-motions.c13
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) {