remove global variable in favor of O(1) hash check

This commit is contained in:
Suraj N. Kurapati 2011-05-25 11:46:20 -07:00
parent 93d4cb73c5
commit b8bb5bd8b0

View file

@ -47,11 +47,6 @@ history-substring-search-begin() {
setopt extendedglob setopt extendedglob
zmodload -i zsh/parameter zmodload -i zsh/parameter
# check if _zsh_highlight-zle-buffer is available
# so that calls to this function will not fail.
history_substring_search_zsh_highlighting_available=0
(( $+functions[_zsh_highlight-zle-buffer] )) && history_substring_search_zsh_highlighting_available=1
if [[ ! ( ( ${WIDGET/backward/forward} = ${LASTWIDGET/backward/forward}) || if [[ ! ( ( ${WIDGET/backward/forward} = ${LASTWIDGET/backward/forward}) ||
( ${WIDGET/forward/backward} = ${LASTWIDGET/forward/backward}) ) ]]; then ( ${WIDGET/forward/backward} = ${LASTWIDGET/forward/backward}) ) ]]; then
# $BUFFER contains the text that is in the command-line currently. # $BUFFER contains the text that is in the command-line currently.
@ -83,7 +78,7 @@ history-substring-search-begin() {
history-substring-search-highlight() { history-substring-search-highlight() {
# highlight $BUFFER using zsh-syntax-highlighting plugin # highlight $BUFFER using zsh-syntax-highlighting plugin
# https://github.com/nicoulaj/zsh-syntax-highlighting # https://github.com/nicoulaj/zsh-syntax-highlighting
if [[ ((( $history_substring_search_zsh_highlighting_available == 1 ) && ( $+BUFFER < $HISTORY_SUBSTRING_SEARCH_MAX_BUFFER_SIZE) )) ]]; then if [[ $+functions[_zsh_highlight-zle-buffer] -eq 1 && $+BUFFER -lt $HISTORY_SUBSTRING_SEARCH_MAX_BUFFER_SIZE ]]; then
_zsh_highlight-zle-buffer _zsh_highlight-zle-buffer
fi fi