vis
a vi-like editor based on Plan 9's structural regular expressions
git clone https://9o.is/git/vis.git
commit 6bd7a048f2b49b99fe0715727ca14af76514491e parent 279814ba832a07e56704f976a5cd05fa110db9b7 Author: Marc André Tanner <mat@brain-dump.org> Date: Thu, 14 Jan 2016 21:10:41 +0100 vis: s/VIS_MODE_LAST/VIS_MODE_INVALID/g Diffstat:
| M | vis-cmds.c | | | 6 | +++--- |
| M | vis-core.h | | | 4 | ++-- |
| M | vis.c | | | 2 | +- |
| M | vis.h | | | 2 | +- |
4 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/vis-cmds.c b/vis-cmds.c @@ -926,7 +926,7 @@ static enum VisMode str2vismode(const char *mode) { if (mode && modes[i] && strcmp(mode, modes[i]) == 0) return i; } - return VIS_MODE_LAST; + return VIS_MODE_INVALID; } static bool cmd_map(Vis *vis, Filerange *range, enum CmdOpt opt, const char *argv[]) { @@ -935,7 +935,7 @@ static bool cmd_map(Vis *vis, Filerange *range, enum CmdOpt opt, const char *arg const char *lhs = argv[2]; const char *rhs = argv[3]; - if (mode == VIS_MODE_LAST || !lhs || !rhs) { + if (mode == VIS_MODE_INVALID || !lhs || !rhs) { vis_info_show(vis, "usage: map mode lhs rhs\n"); return false; } @@ -991,7 +991,7 @@ static bool cmd_unmap(Vis *vis, Filerange *range, enum CmdOpt opt, const char *a enum VisMode mode = str2vismode(argv[1]); const char *lhs = argv[2]; - if (mode == VIS_MODE_LAST || !lhs) { + if (mode == VIS_MODE_INVALID || !lhs) { vis_info_show(vis, "usage: unmap mode lhs rhs\n"); return false; } diff --git a/vis-core.h b/vis-core.h @@ -120,7 +120,7 @@ struct Win { View *view; /* currently displayed part of underlying text */ RingBuffer *jumplist; /* LRU jump management */ ChangeList changelist; /* state for iterating through least recently changes */ - Mode modes[VIS_MODE_LAST]; /* overlay mods used for per window key bindings */ + Mode modes[VIS_MODE_INVALID]; /* overlay mods used for per window key bindings */ Win *parent; /* window which was active when showing the command prompt */ Mode *parent_mode; /* mode which was active when showing the command prompt */ Win *prev, *next; /* neighbouring windows */ @@ -165,7 +165,7 @@ struct Vis { /** stuff used by multiple of the vis-* files */ /* TODO: make part of Vis struct? enable dynamic modes? */ -extern Mode vis_modes[VIS_MODE_LAST]; +extern Mode vis_modes[VIS_MODE_INVALID]; extern Movement moves[VIS_MOVE_INVALID]; diff --git a/vis.c b/vis.c @@ -344,7 +344,7 @@ void vis_free(Vis *vis) { map_free(vis->options); map_free(vis->actions); buffer_release(&vis->input_queue); - for (int i = 0; i < VIS_MODE_LAST; i++) + for (int i = 0; i < VIS_MODE_INVALID; i++) map_free(vis_modes[i].bindings); free(vis); } diff --git a/vis.h b/vis.h @@ -117,7 +117,7 @@ enum VisMode { VIS_MODE_VISUAL_LINE, VIS_MODE_INSERT, VIS_MODE_REPLACE, - VIS_MODE_LAST, + VIS_MODE_INVALID, }; void vis_mode_switch(Vis*, enum VisMode);