about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2009-07-01 13:41:18 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2009-07-01 13:41:18 +0000
commit88d07936a21c262ec5f86518cce3c85fd1951968 (patch)
tree9e3e9bdfbaefb6a74c01e24531598d2cd617c093
parent10787467bc268079951b997b8605dd51cc9047a2 (diff)
downloadzsh-88d07936a21c262ec5f86518cce3c85fd1951968.tar.gz
zsh-88d07936a21c262ec5f86518cce3c85fd1951968.tar.xz
zsh-88d07936a21c262ec5f86518cce3c85fd1951968.zip
27080: it wasnt possible to exit menu selection cleanly
-rw-r--r--ChangeLog7
-rw-r--r--Doc/Zsh/mod_complist.yo5
-rw-r--r--Src/Zle/complist.c20
3 files changed, 27 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog
index 6464af43f..021f0d81b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2009-07-01  Peter Stephenson  <pws@csr.com>
 
+	* 27080: Doc/Zsh/Zsh/mod_complist.yo, Src/Zle/complist.c: it
+	wasn't possible to exit menu selection cleanly.
+
+2009-07-01  Peter Stephenson  <pws@csr.com>
+
 	* 27079: Src/builtin.c: test builtin uses parser and so should
 	save and restore the lexical context to avoid pulling the
 	rug out when called in some nested fashion.
@@ -11876,5 +11881,5 @@
 
 *****************************************************
 * This is used by the shell to define $ZSH_PATCHLEVEL
-* $Revision: 1.4721 $
+* $Revision: 1.4722 $
 *****************************************************
diff --git a/Doc/Zsh/mod_complist.yo b/Doc/Zsh/mod_complist.yo
index 417234c00..3b8baacad 100644
--- a/Doc/Zsh/mod_complist.yo
+++ b/Doc/Zsh/mod_complist.yo
@@ -287,8 +287,9 @@ bottom line.  The following zle functions have special meaning during
 menu selection:
 
 startitem()
-item(tt(accept-line))(
-accepts the current match and leaves menu selection
+item(tt(accept-line), tt(accept-search))(
+accept the current match and leave menu selection (but do
+not cause the command line to be accepted)
 )
 item(tt(send-break))(
 leaves menu selection and restores the previous contents of the
diff --git a/Src/Zle/complist.c b/Src/Zle/complist.c
index 1b6dd083a..41bc7622c 100644
--- a/Src/Zle/complist.c
+++ b/Src/Zle/complist.c
@@ -2572,7 +2572,7 @@ domenuselect(Hookdef dummy, Chdata dat)
                               cmd != Th(z_selfinsertunmeta)))) {
 	    ungetkeycmd();
 	    break;
-	} else if (cmd == Th(z_acceptline)) {
+	} else if (cmd == Th(z_acceptline) || cmd == Th(z_acceptsearch)) {
             if (mode == MM_FSEARCH || mode == MM_BSEARCH) {
                 mode = 0;
                 continue;
@@ -3316,7 +3316,23 @@ domenuselect(Hookdef dummy, Chdata dat)
 	mlbeg = -1;
 	showinglist = ((validlist && !nolist) ? -2 : 0);
 	onlyexpl = oe;
-	if (!smatches)
+	if (acc && listshown) {
+	    /*
+	     * Clear the list without spending sixteen weeks of
+	     * redrawing it in slightly different states first.
+	     * The following seems to work.  I'm not sure what
+	     * the difference is between listshown and showinglist,
+	     * but listshown looks like the traditional thing to
+	     * check for in this file at least.
+	     *
+	     * showinglist has a normally undocumented value of 1,
+	     * and an extra-specially undocumented value of -2, which
+	     * seems to be a force---it appears we need to kick it out
+	     * of that state, though it worries me that in some places
+	     * the code actually forces it back into that state.
+	     */
+	    clearlist = listshown = showinglist = 1;
+	} else if (!smatches)
 	    clearlist = listshown = 1;
 	zrefresh();
     }