1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-10-28 17:10:59 +01:00

unposted: yet more history-beginning-search-menu fixes

This commit is contained in:
Peter Stephenson 2006-08-02 09:59:23 +00:00
parent bb912594b2
commit 21c83849a9
3 changed files with 16 additions and 9 deletions

View file

@ -40,7 +40,7 @@ local -a display
local search=$LBUFFER
search=${search//(#m)[\][()\\*?#<>~]/\\$MATCH/}
search=${search//(#m)[\][()\\*?#<>~^]/\\$MATCH}
if [[ $WIDGET = *-space* ]]; then
# We need to quote metacharacters in the search string
# since they are otherwise active in the reverse subscript.
@ -72,6 +72,12 @@ zle -R "Enter digit${${width##1}:+s}:" $display
integer i
local char 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//?/ })
# Abort on first non-digit entry instead of requiring all
# characters to be typed (as "read -k$width chars" would do).
for (( i = 0; i < $width; i++ )); do
@ -83,12 +89,6 @@ for (( i = 0; i < $width; i++ )); do
chars+=$char
done
# 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 -eq 0 || $chars -gt $n ]]; then
zle -R '' $display
return 1
@ -112,7 +112,7 @@ fi
# go to the last one. This allows accept-line-and-down-history etc.
# to work.
local -a lines
local matchq=${matches[$chars]//(#m)[\][()\\*?#<>~]/\\$MATCH}
local matchq=${matches[$chars]//(#m)[\][()\\*?#<>~^]/\\$MATCH}
lines=(${(kon)history[(R)$matchq]})
HISTNO=$lines[-1]