about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2006-07-28 10:21:06 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2006-07-28 10:21:06 +0000
commit80a6fa6af5d6ab1017dafe492343a0a07003cc24 (patch)
treee37982c70f24a921aa8013b5def1321121cb0086
parentd88220042dc8edfca90b37ffd8c46ef5a817433b (diff)
downloadzsh-80a6fa6af5d6ab1017dafe492343a0a07003cc24.tar.gz
zsh-80a6fa6af5d6ab1017dafe492343a0a07003cc24.tar.xz
zsh-80a6fa6af5d6ab1017dafe492343a0a07003cc24.zip
22560: tweak history-beginning-search-menu to clear menu after use
-rw-r--r--ChangeLog3
-rw-r--r--Functions/Zle/history-beginning-search-menu13
2 files changed, 16 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index b3b855778..4c3244251 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2006-07-28  Peter Stephenson  <pws@csr.com>
 
+	* 22560: Functions/Zle/history-beginning-search-menu:
+	tweak (= hack) to clear menu after use.
+
 	* 22559: Doc/Zsh/contrib.yo,
 	Functions/Zle/history-beginning-search-menu: new Zle function.
 
diff --git a/Functions/Zle/history-beginning-search-menu b/Functions/Zle/history-beginning-search-menu
index 37d3aec17..616cc7d7f 100644
--- a/Functions/Zle/history-beginning-search-menu
+++ b/Functions/Zle/history-beginning-search-menu
@@ -41,6 +41,10 @@ local -a display
 local search=$LBUFFER
 
 if [[ $WIDGET = *-space* ]]; then
+  # We need to quote metacharacters in the search string
+  # since they are otherwise active in the reverse subscript.
+  # We need to avoid quoting other characters since they aren't
+  # and just stay quoted, rather annoyingly.
   search=${search//(#m)[*?#<>]/\\$MATCH/}
   search=${search// /*}
 fi
@@ -68,7 +72,14 @@ zle -R "Enter digit${${width##1}:+s}:" $display
 local chars
 read -k$width chars
 
+# Hmmm... this isn't great.  The only way of clearing the display
+# appears to be to overwrite it completely.  I think that's because
+# displaying strings in this way doesn't set the completion list
+# properly.
+display=(${display//?/ })
+
 if [[ $chars != [[:digit:]]## || $chars -eq 0 || $chars -gt $n ]]; then
+  zle -R '' $display
   return 1
 fi
 
@@ -87,3 +98,5 @@ else
   BUFFER=${matches[$chars]}
   (( newcursor )) && CURSOR=$newcursor
 fi
+
+zle -R '' $display