diff options
author | Sven Wischnowsky <wischnow@users.sourceforge.net> | 2001-03-27 09:14:50 +0000 |
---|---|---|
committer | Sven Wischnowsky <wischnow@users.sourceforge.net> | 2001-03-27 09:14:50 +0000 |
commit | 6d72dca54fbbf3e86807502288ace649f5fbe05c (patch) | |
tree | 92fac1ca5f8121f253fbe77662c1a3fd2d4bef08 | |
parent | b0176cb54f2a7fdde6e4226e0691c88c1674af34 (diff) | |
download | zsh-6d72dca54fbbf3e86807502288ace649f5fbe05c.tar.gz zsh-6d72dca54fbbf3e86807502288ace649f5fbe05c.tar.xz zsh-6d72dca54fbbf3e86807502288ace649f5fbe05c.zip |
try to make _h_c_w smarter at the beginning and end of the list; avoid list-beeping if the old completion list is re-used (3752)
-rw-r--r-- | ChangeLog | 7 | ||||
-rw-r--r-- | Completion/Commands/_history_complete_word | 53 | ||||
-rw-r--r-- | Src/Zle/compresult.c | 2 |
3 files changed, 42 insertions, 20 deletions
diff --git a/ChangeLog b/ChangeLog index 57dd6ac1a..e8093256e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2001-03-27 Sven Wischnowsky <wischnow@zsh.org> + + * 3752: Completion/Commands/_history_complete_word, + Src/Zle/compresult.c: try to make _h_c_w smarter at the + beginning and end of the list; avoid list-beeping if the old + completion list is re-used + 2001-03-26 Clint Adams <schizo@debian.org> * 13783 from Michal Politowski: Completion/Builtins/_pids: diff --git a/Completion/Commands/_history_complete_word b/Completion/Commands/_history_complete_word index 48adb34bc..c4c762393 100644 --- a/Completion/Commands/_history_complete_word +++ b/Completion/Commands/_history_complete_word @@ -50,36 +50,51 @@ _history_complete_word () { slice=$max fi - if [[ -n "$compstate[old_list]" && - ( -n "$stop" || "$compstate[insert]" = menu ) ]] ; then - # array of matches is newest -> oldest (reverse of history order) - if [[ "$direction" == 'older' ]]; then - if [[ compstate[old_insert] -eq $_hist_menu_length || - "$_hist_stop" == 'oldest' ]]; then - _hist_stop='oldest' - [[ "$stop" = verbose ]] && - _message 'beginning of history reached' - elif [[ "$_hist_stop" == 'newest' ]]; then - zle -Rc + if [[ ( -n "$compstate[old_list]" || + ( $LASTWIDGET = _history-complete-* && -n $_hist_stop ) ) && + ( -n "$stop" || "$compstate[insert]" = menu ) ]]; then + if [[ "$direction" == older ]]; then + if [[ $_hist_stop = new ]]; then + PREFIX=$_hist_old_prefix _history_complete_word_gen_matches - else + compstate[insert]=2 + _hist_stop= + elif [[ $_hist_stop = old ]]; then + PREFIX=$_hist_old_prefix + _history_complete_word_gen_matches + compstate[insert]=1 + _hist_stop= + elif [[ compstate[old_insert] -lt _hist_menu_length ]]; then compstate[old_list]=keep (( compstate[insert] = compstate[old_insert] + 1 )) + else + _hist_stop=old + _message 'beginning of history reached' + return 1 fi elif [[ "$direction" == 'newer' ]]; then - if [[ compstate[old_insert] -eq 1 || "$_hist_stop" == 'newest' ]]; then - _hist_stop='newest' - [[ "$stop" = verbose ]] && _message 'end of history reached' - elif [[ "$_hist_stop" == 'oldest' ]]; then - zle -Rc + if [[ $_hist_stop = old ]]; then + PREFIX=$_hist_old_prefix _history_complete_word_gen_matches - else + compstate[insert]=$(( $compstate[nmatches] - 1 )) + _hist_stop= + elif [[ $_hist_stop = new ]]; then + PREFIX=$_hist_old_prefix + _history_complete_word_gen_matches + compstate[insert]=$compstate[nmatches] + _hist_stop= + elif [[ compstate[old_insert] -gt 1 ]]; then compstate[old_list]=keep (( compstate[insert] = compstate[old_insert] - 1 )) + else + _hist_stop=new + _message 'end of history reached' + return 1 fi fi + return 0 else - _hist_stop='' + _hist_stop= _hist_old_prefix="$PREFIX" _history_complete_word_gen_matches fi diff --git a/Src/Zle/compresult.c b/Src/Zle/compresult.c index 9b85948f9..74bc577e7 100644 --- a/Src/Zle/compresult.c +++ b/Src/Zle/compresult.c @@ -822,7 +822,7 @@ do_ambiguous(void) /* At this point, we might want a completion listing. Show the listing * * if it is needed. */ - if (isset(LISTBEEP)) + if (isset(LISTBEEP) && !oldlist) ret = 1; if (uselist && (usemenu != 2 || (!listshown && !oldlist)) && |