From edb9c94025cebb853142c7e91b88c991ddd21b22 Mon Sep 17 00:00:00 2001 From: Oliver Kiddle Date: Fri, 12 Dec 2014 14:12:55 +0100 Subject: 33950: ignore KEYTIMEOUT for vi operators --- Src/Zle/iwidgets.list | 12 ++++++------ Src/Zle/zle.h | 11 ++++++----- Src/Zle/zle_keymap.c | 8 +++++++- 3 files changed, 19 insertions(+), 12 deletions(-) (limited to 'Src') diff --git a/Src/Zle/iwidgets.list b/Src/Zle/iwidgets.list index 40750221e..5e598cc79 100644 --- a/Src/Zle/iwidgets.list +++ b/Src/Zle/iwidgets.list @@ -134,11 +134,11 @@ "vi-backward-blank-word-end", vibackwardblankwordend, 0 "vi-beginning-of-line", vibeginningofline, 0 "vi-caps-lock-panic", vicapslockpanic, ZLE_LASTCOL -"vi-change", vichange, ZLE_LASTCOL +"vi-change", vichange, ZLE_LASTCOL | ZLE_VIOPER "vi-change-eol", vichangeeol, 0 "vi-change-whole-line", vichangewholeline, 0 "vi-cmd-mode", vicmdmode, 0 -"vi-delete", videlete, ZLE_KEEPSUFFIX | ZLE_LASTCOL +"vi-delete", videlete, ZLE_KEEPSUFFIX | ZLE_LASTCOL | ZLE_VIOPER "vi-delete-char", videletechar, ZLE_KEEPSUFFIX "vi-digit-or-beginning-of-line", vidigitorbeginningofline, 0 "vi-down-line-or-history", vidownlineorhistory, ZLE_LINEMOVE @@ -159,7 +159,7 @@ "vi-goto-mark-line", vigotomarkline, ZLE_LINEMOVE "vi-history-search-backward", vihistorysearchbackward, 0 "vi-history-search-forward", vihistorysearchforward, 0 -"vi-indent", viindent, ZLE_LASTCOL +"vi-indent", viindent, ZLE_LASTCOL | ZLE_VIOPER "vi-insert", viinsert, 0 "vi-insert-bol", viinsertbol, 0 "vi-join", vijoin, 0 @@ -168,7 +168,7 @@ "vi-match-bracket", vimatchbracket, 0 "vi-open-line-above", viopenlineabove, 0 "vi-open-line-below", viopenlinebelow, 0 -"vi-oper-swap-case", vioperswapcase, ZLE_LASTCOL +"vi-oper-swap-case", vioperswapcase, ZLE_LASTCOL | ZLE_VIOPER "vi-pound-insert", vipoundinsert, 0 "vi-put-after", viputafter, ZLE_YANKAFTER | ZLE_KEEPSUFFIX "vi-put-before", viputbefore, ZLE_YANKBEFORE | ZLE_KEEPSUFFIX @@ -185,9 +185,9 @@ "vi-substitute", visubstitute, 0 "vi-swap-case", viswapcase, ZLE_LASTCOL "vi-undo-change", viundochange, ZLE_KEEPSUFFIX -"vi-unindent", viunindent, ZLE_LASTCOL +"vi-unindent", viunindent, ZLE_LASTCOL | ZLE_VIOPER "vi-up-line-or-history", viuplineorhistory, ZLE_LINEMOVE -"vi-yank", viyank, ZLE_LASTCOL +"vi-yank", viyank, ZLE_LASTCOL | ZLE_VIOPER "vi-yank-eol", viyankeol, 0 "vi-yank-whole-line", viyankwholeline, 0 "visual-line-mode", visuallinemode, ZLE_MENUCMP | ZLE_LASTCOL diff --git a/Src/Zle/zle.h b/Src/Zle/zle.h index a46b52ded..3c652909e 100644 --- a/Src/Zle/zle.h +++ b/Src/Zle/zle.h @@ -207,11 +207,12 @@ struct widget { #define ZLE_YANKBEFORE (1<<4) #define ZLE_YANK (ZLE_YANKAFTER | ZLE_YANKBEFORE) #define ZLE_LINEMOVE (1<<5) /* command is a line-oriented movement */ -#define ZLE_LASTCOL (1<<6) /* command maintains lastcol correctly */ -#define ZLE_KILL (1<<7) -#define ZLE_KEEPSUFFIX (1<<8) /* DON'T remove added suffix */ -#define ZLE_NOTCOMMAND (1<<9) /* widget should not alter lastcmd */ -#define ZLE_ISCOMP (1<<10) /* usable for new style completion */ +#define ZLE_VIOPER (1<<6) /* widget reads further keys so wait if prefix */ +#define ZLE_LASTCOL (1<<7) /* command maintains lastcol correctly */ +#define ZLE_KILL (1<<8) +#define ZLE_KEEPSUFFIX (1<<9) /* DON'T remove added suffix */ +#define ZLE_NOTCOMMAND (1<<10) /* widget should not alter lastcmd */ +#define ZLE_ISCOMP (1<<11) /* usable for new style completion */ /* thingies */ diff --git a/Src/Zle/zle_keymap.c b/Src/Zle/zle_keymap.c index 48f210c7e..b703ebee1 100644 --- a/Src/Zle/zle_keymap.c +++ b/Src/Zle/zle_keymap.c @@ -1444,6 +1444,7 @@ getkeymapcmd(Keymap km, Thingy *funcp, char **strp) Thingy func = t_undefinedkey; char *str = NULL; int lastlen = 0, lastc = lastchar; + int timeout = 0; keybuflen = 0; keybuf[0] = 0; @@ -1461,7 +1462,7 @@ getkeymapcmd(Keymap km, Thingy *funcp, char **strp) * argument to bindkey is in the correct form for the locale. * That's beyond our control. */ - while(getkeybuf(!!lastlen) != EOF) { + while(getkeybuf(timeout) != EOF) { char *s; Thingy f; int loc = !!localkeymap; @@ -1480,6 +1481,11 @@ getkeymapcmd(Keymap km, Thingy *funcp, char **strp) func = f; str = s; lastc = lastchar; + + /* can be patient with vi commands that need a motion operator: * + * they wait till a key is pressed for the movement anyway */ + timeout = !(!virangeflag && !region_active && f && f->widget && + f->widget->flags & ZLE_VIOPER); } if (!ispfx) break; -- cgit 1.4.1