skip HIST_FIND_NO_DUPS if HIST_IGNORE_ALL_DUPS set

Thanks to @ELLIOTTCABLE for suggesting this optimization:
https://github.com/zsh-users/zsh-history-substring-search/issues/19#issuecomment-90295460
This commit is contained in:
Suraj N. Kurapati 2015-04-06 17:33:27 -07:00
parent b5c81fd750
commit 6d7bc718ae

View file

@ -474,8 +474,9 @@ function _history-substring-search-up-search() {
#
# When HIST_FIND_NO_DUPS is set, meaning that only unique command lines from
# history should be matched, make sure the new and old results are different.
# But when HIST_IGNORE_ALL_DUPS is set, ZSH already ensures a unique history.
#
if [[ -o HIST_FIND_NO_DUPS && $BUFFER == $_history_substring_search_result ]]; then
if [[ ! -o HIST_IGNORE_ALL_DUPS && -o HIST_FIND_NO_DUPS && $BUFFER == $_history_substring_search_result ]]; then
#
# Repeat the current search so that a different (unique) match is found.
#
@ -570,8 +571,9 @@ function _history-substring-search-down-search() {
#
# When HIST_FIND_NO_DUPS is set, meaning that only unique command lines from
# history should be matched, make sure the new and old results are different.
# But when HIST_IGNORE_ALL_DUPS is set, ZSH already ensures a unique history.
#
if [[ -o HIST_FIND_NO_DUPS && $BUFFER == $_history_substring_search_result ]]; then
if [[ ! -o HIST_IGNORE_ALL_DUPS && -o HIST_FIND_NO_DUPS && $BUFFER == $_history_substring_search_result ]]; then
#
# Repeat the current search so that a different (unique) match is found.
#