summary refs log tree commit diff
path: root/Src
diff options
context:
space:
mode:
authorOliver Kiddle <opk@zsh.org>2014-12-12 14:12:55 +0100
committerOliver Kiddle <opk@zsh.org>2014-12-12 14:14:00 +0100
commitedb9c94025cebb853142c7e91b88c991ddd21b22 (patch)
tree144c1c98f13c0c476fe8c5755db0f02e0758cc3a /Src
parentd067ebcacd55472f720b2765ec686a69b25c9a90 (diff)
downloadzsh-edb9c94025cebb853142c7e91b88c991ddd21b22.tar.gz
zsh-edb9c94025cebb853142c7e91b88c991ddd21b22.tar.xz
zsh-edb9c94025cebb853142c7e91b88c991ddd21b22.zip
33950: ignore KEYTIMEOUT for vi operators
Diffstat (limited to 'Src')
-rw-r--r--Src/Zle/iwidgets.list12
-rw-r--r--Src/Zle/zle.h11
-rw-r--r--Src/Zle/zle_keymap.c8
3 files changed, 19 insertions, 12 deletions
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;