remove useless last_entry_in_history variable
This commit is contained in:
parent
89513675c3
commit
ffaecb6efc
1 changed files with 8 additions and 39 deletions
|
|
@ -293,27 +293,14 @@ _history-substring-search-down-buffer() {
|
||||||
|
|
||||||
_history-substring-search-up-history() {
|
_history-substring-search-up-history() {
|
||||||
#
|
#
|
||||||
# When searching without a search query history-substring-search-up should
|
# Behave like up in ZSH, except clear the $BUFFER
|
||||||
# behave like up-history. Apart from this, such a search should end with an
|
# when beginning of history is reached like in Fish.
|
||||||
# empty $BUFFER like in Fish.
|
|
||||||
#
|
#
|
||||||
if [[ -z $_history_substring_search_query ]]; then
|
if [[ -z $_history_substring_search_query ]]; then
|
||||||
# As long as we are not at the last history entry, call up-history():
|
|
||||||
if [[ $HISTNO -gt 1 ]]; then
|
if [[ $HISTNO -gt 1 ]]; then
|
||||||
zle up-history
|
zle up-history
|
||||||
else
|
else
|
||||||
#
|
|
||||||
# [[ $HISTNO -eq 1 ]] means that _history-substring-search-up-history()
|
|
||||||
# has arrived at the last entry of the history file. In that case we
|
|
||||||
# make $_history_substring_search_last_entry_in_history equal to
|
|
||||||
# $BUFFER. This value can later be retrieved by
|
|
||||||
# _history-substring-search-down-history(). Moreover the current buffer
|
|
||||||
# should be made empty. In all other cases
|
|
||||||
# $_history_substring_search_last_entry_in_history should remain empty:
|
|
||||||
#
|
|
||||||
if [[ $#_history_substring_search_last_entry_in_history -eq 0 ]]; then
|
|
||||||
_history_substring_search_last_entry_in_history=$BUFFER
|
|
||||||
fi
|
|
||||||
BUFFER=''
|
BUFFER=''
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
@ -325,33 +312,15 @@ _history-substring-search-up-history() {
|
||||||
|
|
||||||
_history-substring-search-down-history() {
|
_history-substring-search-down-history() {
|
||||||
#
|
#
|
||||||
# When searching without a search query the widget
|
# Behave like down-history in ZSH, except clear the
|
||||||
# history-substring-search-down should behave like down-history. Apart
|
# $BUFFER when end of history is reached like in Fish.
|
||||||
# from this, such a search should end with an empty buffer:
|
|
||||||
#
|
#
|
||||||
if [[ -z $_history_substring_search_query ]]; then
|
if [[ -z $_history_substring_search_query ]]; then
|
||||||
#
|
|
||||||
# If _history-substring-search-up-history() has previously arrived at the
|
if [[ $HISTNO -le $#history ]]; then
|
||||||
# last history entry it will have made
|
|
||||||
# $_history_substring_search_last_entry_in_history equal to $BUFFER (see
|
|
||||||
# the description of _history-substring-search-up-history()). Therefore,
|
|
||||||
# here we test if $_history_substring_search_last_entry_in_history is
|
|
||||||
# equal to an empty string:
|
|
||||||
#
|
|
||||||
if [[ $#_history_substring_search_last_entry_in_history -eq 0 ]]; then
|
|
||||||
# If so we can safely call down-history():
|
|
||||||
zle down-history
|
zle down-history
|
||||||
else
|
else
|
||||||
# If not we make $BUFFER equal to
|
BUFFER=''
|
||||||
# $_history_substring_search_last_entry_in_history and we move the the
|
|
||||||
# cursor to the end of the buffer:
|
|
||||||
BUFFER=$_history_substring_search_last_entry_in_history
|
|
||||||
CURSOR=$#BUFFER
|
|
||||||
|
|
||||||
# And we make $_history_substring_search_last_entry_in_history equal to
|
|
||||||
# an empty string, so that later we will be able to call up-history()
|
|
||||||
# and down-history() again:
|
|
||||||
_history_substring_search_last_entry_in_history=''
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
return true
|
return true
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue