about summary refs log tree commit diff
diff options
context:
space:
mode:
authorOliver Kiddle <opk@zsh.org>2016-11-05 00:34:43 +0100
committerOliver Kiddle <opk@zsh.org>2016-11-05 00:36:29 +0100
commit58ce2f119a42f115e9ed5c1b6a35e5837d4f6776 (patch)
tree41235619094d9bd4d872bc1a78249c728ce7e482
parent5c28031ea6f0095aa80afa56c3264c6cc5f36fbb (diff)
downloadzsh-58ce2f119a42f115e9ed5c1b6a35e5837d4f6776.tar.gz
zsh-58ce2f119a42f115e9ed5c1b6a35e5837d4f6776.tar.xz
zsh-58ce2f119a42f115e9ed5c1b6a35e5837d4f6776.zip
39829: when compstate[insert] is emptied by the completion function and AUTO_MENU is set, start menu completion on the second tab press rather than the third
-rw-r--r--ChangeLog6
-rw-r--r--Src/Zle/compcore.c10
2 files changed, 13 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 9f8e5a0c3..a8f2c0b1d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2016-11-04  Oliver Kiddle  <opk@zsh.org>
 
+	* 39829: Src/Zle/compcore.c: when compstate[insert] is emptied
+	by the completion function and AUTO_MENU is set, start menu
+	completion on the second tab press rather than the third
+
 	* 39834: Src/builtin.c, Completion/Zsh/Command/_print,
 	Completion/Zsh/Command/_fc, Completion/Zsh/Type/_ps1234:
 	when print used with -v and -l, include a final
@@ -3363,7 +3367,7 @@
 
 2015-09-11  Daniel Shahaf  <d.s@daniel.shahaf.name>
 
-	* 36443: Doc/Zsh/zle.yo Src/Zle/zle_refresh.c: 
+	* 36443: Doc/Zsh/zle.yo Src/Zle/zle_refresh.c:
 	Highlight pasted/yanked text as standout by default (i.e., when
 	$zle_highlight doesn't specify otherwise).
 
diff --git a/Src/Zle/compcore.c b/Src/Zle/compcore.c
index fe16c1300..536bca7b3 100644
--- a/Src/Zle/compcore.c
+++ b/Src/Zle/compcore.c
@@ -835,6 +835,7 @@ callcompfunc(char *s, char *fn)
 	endparamscope();
 	lastcmd = 0;
 	incompfunc = icf;
+	startauto = 0;
 
 	if (!complist)
 	    uselist = 0;
@@ -882,8 +883,13 @@ callcompfunc(char *s, char *fn)
 		useline = 1, usemenu = 1;
 	    else if (strpfx("auto", compinsert))
 		useline = 1, usemenu = 2;
-	    else
+	    else {
 		useline = usemenu = 0;
+		/* if compstate[insert] was emptied, no unambiguous prefix
+		 * ever gets inserted so allow the next tab to already start
+		 * menu completion */
+		startauto = lastambig = isset(AUTOMENU);
+	    }
 
 	    if (useline && (p = strchr(compinsert, ':'))) {
 		insmnum = atoi(++p);
@@ -896,7 +902,7 @@ callcompfunc(char *s, char *fn)
 #endif
 	    }
 	}
-	startauto = ((compinsert &&
+	startauto = startauto || ((compinsert &&
 		      !strcmp(compinsert, "automenu-unambiguous")) ||
 		     (bashlistfirst && isset(AUTOMENU) &&
                       (!compinsert || !*compinsert)));