Closed pro-sumer closed 4 months ago
same here
i get it too. specifically when i type -
after pressing an up/down arrow key.
it prints the message and doesn't add a -
to the prompt, but everything works after that, and typing another -
works as expected. until the next up/down arrow key.
The proposed fix only fixes the -
case for me but not the <space>
case which is much more annoying to me ;)
Additionally quoting the argument helps:
--- a/zsh-history-substring-search.zsh
+++ b/zsh-history-substring-search.zsh
@@ -406,7 +406,7 @@ _history-substring-search-end() {
# For debugging purposes:
# zle -R "mn: "$_history_substring_search_match_index" m#: "${#_history_substring_search_matches}
- # read -k -t 200 && zle -U $REPLY
+ # read -k -t 200 && zle -U -- "$REPLY"
#
# When this function returns, z-sy-h runs its line-pre-redraw hook. It has no
@@ -421,7 +421,7 @@ _history-substring-search-end() {
# before removing search highlight and exiting. This ensures no highlights
# are left lingering after search is finished.
#
- read -k -t ${HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_TIMEOUT:-1} && zle -U $REPLY
+ read -k -t ${HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_TIMEOUT:-1} && zle -U -- "$REPLY"
region_highlight=( "${(@)region_highlight:#*${highlight_memo}*}" )
fi
Can you explain how to reproduce the <space>
case?
This change looks good regardless.
Just like the -
case, press arrow up and then the space
key. I get the same error as with -
.
I thought this was just another symptom of the same thing as with -
. But after your question I investigated further with a minimal config and it seems the culprit is setopt SH_WORD_SPLIT
. I added that years ago for compatability reasons.
Maybe the plugin could unset that option for itself so that the users config does not interfere with its functionality.
I see. It seems that quoting the variable fixes it regardless, so I don't think we will need to unset SH_WORD_SPLIT
.
is the fix on its way? The error is quite obnoxious :sweat_smile:
@xeruf This will be fixed when #159 is merged.
Until then, you can change the package url to github.com/dxrcy/zsh-history-substring-search
change the package url to github.com/dxrcy/zsh-history-substring-search
Better to fork that fork again before using for security 😉.
Recently I have been getting this error when trying to reuse commands from my zsh history:
What am I doing wrong? Or what is broken?