diff --git a/ChangeLog b/ChangeLog
index 4898d42aa..4a4795618 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2006-08-01 Peter Stephenson
+
+ * 22574: Functions/Zle/history-beginning-search-menu,
+ Doc/Zsh/params.yo: ~ also needs quoting and we have to do
+ it even if space isn't active.
+
2006-08-01 Peter Stephenson
* 22573: Functions/Zle/history-beginning-search-menu,
diff --git a/Doc/Zsh/params.yo b/Doc/Zsh/params.yo
index fe005ed21..6c637f93d 100644
--- a/Doc/Zsh/params.yo
+++ b/Doc/Zsh/params.yo
@@ -221,7 +221,7 @@ the tt(EXTENDED_GLOB) option is set, the following is sufficient to
match an element of an array tt($array) containing exactly the value of
tt($key):
-example(key2=${key//(#m)[\][+LPAR()+RPAR()\\*?#<>]/\\$MATCH}
+example(key2=${key//(#m)[\][+LPAR()+RPAR()\\*?#<>~]/\\$MATCH}
print ${array[(R)$key2]})
)
item(tt(R))(
diff --git a/Functions/Zle/history-beginning-search-menu b/Functions/Zle/history-beginning-search-menu
index 46a6a776b..dadcc40cb 100644
--- a/Functions/Zle/history-beginning-search-menu
+++ b/Functions/Zle/history-beginning-search-menu
@@ -40,12 +40,12 @@ local -a display
local search=$LBUFFER
+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.
# We need to avoid quoting other characters since they aren't
# and just stay quoted, rather annoyingly.
- search=${search//(#m)[\][()\\*?#<>]/\\$MATCH/}
search=${search// /*}
fi
@@ -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]