From 68a899b8faf83cc7c0f00def991acb28dc6d7135 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Andr=C3=A9=20Tanner?= Date: Tue, 10 Jan 2017 20:57:55 +0100 Subject: vis: add valid marks to :help output --- vis.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'vis.c') diff --git a/vis.c b/vis.c index 43534a2..1cd5b8f 100644 --- a/vis.c +++ b/vis.c @@ -29,6 +29,11 @@ #include "vis-core.h" #include "sam.h" +const MarkDef vis_marks[] = { + [VIS_MARK_SELECTION_START] = { '<', "Last selection start" }, + [VIS_MARK_SELECTION_END] = { '>', "Last selection end" }, +}; + static Macro *macro_get(Vis *vis, enum VisRegister); static void macro_replay(Vis *vis, const Macro *macro); static void vis_keys_push(Vis *vis, const char *input, size_t pos, bool record); @@ -1262,10 +1267,10 @@ void vis_repeat(Vis *vis) { enum VisMark vis_mark_from(Vis *vis, char mark) { if (mark >= 'a' && mark <= 'z') return VIS_MARK_a + mark - 'a'; - else if (mark == '<') - return VIS_MARK_SELECTION_START; - else if (mark == '>') - return VIS_MARK_SELECTION_END; + for (size_t i = 0; i < LENGTH(vis_marks); i++) { + if (vis_marks[i].name == mark) + return i; + } return VIS_MARK_INVALID; } -- cgit v1.2.3