vis

a vi-like editor based on Plan 9's structural regular expressions

git clone https://9o.is/git/vis.git

commit 9c367157f6d65e8a899771bffb4910dccbafcda8
parent 0e4b450d4a6a0460b4ab76f105b52fa06eebdfe0
Author: Marc André Tanner <mat@brain-dump.org>
Date:   Sun, 11 Oct 2015 23:05:16 +0200

vis: properly ignore tab at command prompt

Closes #77

Diffstat:
Mconfig.def.h | 8+++++++-
Mvis.c | 6++++++
2 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/config.def.h b/config.def.h @@ -222,6 +222,7 @@ enum { VIS_ACTION_TEXT_OBJECT_LINE_INNER, VIS_ACTION_MOTION_CHARWISE, VIS_ACTION_MOTION_LINEWISE, + VIS_ACTION_NOP, }; static KeyAction vis_action[] = { @@ -985,6 +986,11 @@ static KeyAction vis_action[] = { "Force motion to be linewise", motiontype, { .i = LINEWISE } }, + [VIS_ACTION_NOP] = { + "nop", + "Ignore key, do nothing", + nop, + }, }; static KeyBinding basic_movement[] = { @@ -1299,7 +1305,7 @@ static KeyBinding vis_mode_prompt[] = { { "<Backspace>", ACTION(PROMPT_BACKSPACE) }, { "<Enter>", ACTION(PROMPT_ENTER) }, { "<C-j>", ALIAS("<Enter>") }, - { "<Tab>", }, + { "<Tab>", ACTION(NOP) }, { /* empty last element, array terminator */ }, }; diff --git a/vis.c b/vis.c @@ -301,6 +301,8 @@ static TextObject textobjs[] = { }; /** functions to be called from keybindings */ +/* ignore key, do nothing */ +static const char *nop(const char *keys, const Arg *arg); /* navigate jump list either in forward (arg->i>0) or backward (arg->i<0) direction */ static const char *jumplist(const char *keys, const Arg *arg); /* navigate change list either in forward (arg->i>0) or backward (arg->i<0) direction */ @@ -782,6 +784,10 @@ static size_t view_lines_bottom(const Arg *arg) { /** key bindings functions */ +static const char *nop(const char *keys, const Arg *arg) { + return keys; +} + static const char *jumplist(const char *keys, const Arg *arg) { size_t pos; if (arg->i > 0)