mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-10-23 16:40:24 +02:00
22560: tweak history-beginning-search-menu to clear menu after use
This commit is contained in:
parent
d88220042d
commit
80a6fa6af5
2 changed files with 16 additions and 0 deletions
|
@ -1,5 +1,8 @@
|
||||||
2006-07-28 Peter Stephenson <pws@csr.com>
|
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,
|
* 22559: Doc/Zsh/contrib.yo,
|
||||||
Functions/Zle/history-beginning-search-menu: new Zle function.
|
Functions/Zle/history-beginning-search-menu: new Zle function.
|
||||||
|
|
||||||
|
|
|
@ -41,6 +41,10 @@ local -a display
|
||||||
local search=$LBUFFER
|
local search=$LBUFFER
|
||||||
|
|
||||||
if [[ $WIDGET = *-space* ]]; then
|
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//(#m)[*?#<>]/\\$MATCH/}
|
||||||
search=${search// /*}
|
search=${search// /*}
|
||||||
fi
|
fi
|
||||||
|
@ -68,7 +72,14 @@ zle -R "Enter digit${${width##1}:+s}:" $display
|
||||||
local chars
|
local chars
|
||||||
read -k$width 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
|
if [[ $chars != [[:digit:]]## || $chars -eq 0 || $chars -gt $n ]]; then
|
||||||
|
zle -R '' $display
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -87,3 +98,5 @@ else
|
||||||
BUFFER=${matches[$chars]}
|
BUFFER=${matches[$chars]}
|
||||||
(( newcursor )) && CURSOR=$newcursor
|
(( newcursor )) && CURSOR=$newcursor
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
zle -R '' $display
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue