From ad10da5cc094204eb6f319841ab73246b689abb4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Andr=C3=A9=20Tanner?= Date: Sat, 8 Jul 2017 09:52:56 +0200 Subject: vis: cleanup marks implementation We now use ' to refer to marks. Mark a is set using 'am and restored using 'aM while this is slightly harder to type than ma and 'a it is consistent with register usage for yank/put and allows a default mark to be used which is handy for quick selection manipulation primitives. --- vis-motions.c | 31 ------------------------------- 1 file changed, 31 deletions(-) (limited to 'vis-motions.c') diff --git a/vis-motions.c b/vis-motions.c index b07585b..5b55288 100644 --- a/vis-motions.c +++ b/vis-motions.c @@ -107,19 +107,6 @@ 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, 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, Selection *sel) { - return text_line_start(file->text, mark_goto(vis, file, sel)); -} - static size_t to(Vis *vis, Text *txt, size_t pos) { char c; if (pos == text_line_end(txt, pos)) @@ -394,16 +381,6 @@ bool vis_motion(Vis *vis, enum VisMotion motion, ...) { goto err; } break; - case VIS_MOVE_MARK: - case VIS_MOVE_MARK_LINE: - { - int mark = va_arg(ap, int); - if (VIS_MARK_a <= mark && mark < VIS_MARK_INVALID) - vis->action.mark = mark; - else - goto err; - break; - } default: break; } @@ -605,14 +582,6 @@ const Movement vis_motions[] = { .vis = till, .type = INCLUSIVE|COUNT_EXACT, }, - [VIS_MOVE_MARK] = { - .file = mark_goto, - .type = JUMP|IDEMPOTENT, - }, - [VIS_MOVE_MARK_LINE] = { - .file = mark_line_goto, - .type = LINEWISE|JUMP|IDEMPOTENT, - }, [VIS_MOVE_SEARCH_WORD_FORWARD] = { .vis = search_word_forward, .type = JUMP, -- cgit v1.2.3