1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-09-24 17:21:08 +02:00

allow insert-tab to contain `pending[=num]' to handle the case when there is pending input (?)

This commit is contained in:
Sven Wischnowsky 2000-06-13 11:45:26 +00:00
parent 428abf6455
commit a707108a75
2 changed files with 24 additions and 4 deletions

View file

@ -23,7 +23,7 @@ exec </dev/null # ZLE closes stdin, which can cause errors
# Failed returns from this code are not real errors # Failed returns from this code are not real errors
setopt localtraps noerrexit ; trap - ZERR setopt localtraps noerrexit ; trap - ZERR
local func funcs ret=1 tmp _compskip format nm call \ local func funcs ret=1 tmp _compskip format nm call match \
_completers _completer _completer_num curtag _comp_force_list \ _completers _completer _completer_num curtag _comp_force_list \
_matchers _matcher _matcher_num _comp_tags _comp_mesg \ _matchers _matcher _matcher_num _comp_tags _comp_mesg \
context state line opt_args val_args curcontext="$curcontext" \ context state line opt_args val_args curcontext="$curcontext" \
@ -38,8 +38,18 @@ typeset -U _lastdescr _comp_ignore
[[ -z "$curcontext" ]] && curcontext=::: [[ -z "$curcontext" ]] && curcontext=:::
if [[ "$compstate[insert]" = tab* && "$WIDGET" != *list* ]]; then zstyle -s ":completion:${curcontext}:" insert-tab tmp || tmp=no
{ zstyle -T ":completion:${curcontext}:" insert-tab &&
if [[ "$tmp" = *pending(|[[:blank:]]*) ||
( "$tmp" = *pending=(#b)([0-9]##)(|[[:blank:]]*) &&
PENDING -ge $match[1] ) ]]; then
compstate[insert]=tab
return 0
fi
if [[ "$compstate[insert]" = tab* ]]; then
{ "$tmp" = (|[[:blank:]]*)(yes|true|on|1)(|[[:blank:]]*) &&
{ [[ "$curcontext" != :* || -z "$compstate[vared]" ]] || { [[ "$curcontext" != :* || -z "$compstate[vared]" ]] ||
zstyle -t ":completion:vared${curcontext}:" insert-tab } } && return 0 zstyle -t ":completion:vared${curcontext}:" insert-tab } } && return 0

View file

@ -1278,6 +1278,16 @@ insert a TAB character (assuming it was used to start completion) instead
of performing completion when there is no non-blank character to the left of performing completion when there is no non-blank character to the left
of the cursor. If set to `false', completion will be done even there. of the cursor. If set to `false', completion will be done even there.
The value may also contain the substrings `tt(pending)' or
`tt(pending=)var(val)' to make the character typed to start completion
be inserted instead of completion being tried when there is input
pending which has not yet been processed by the shell. If a var(val)
is given, completion will not be done if there are at least that many
characters of unprocessed input. This is often useful to have set when
pasting characters into a terminal. Note however, that it relies on
the tt($PENDING) special parameter from the tt(zle) module being set
properly which is not guaranteed on all platforms.
The default value of this style is `true' unless when completing The default value of this style is `true' unless when completing
inside the tt(vared) builtin command, where it defaults to `false'. inside the tt(vared) builtin command, where it defaults to `false'.
) )
@ -2442,7 +2452,7 @@ Unlike tt(_expand) this uses a `tt(1)' (one) as the default
value for the tt(substitute) and tt(glob) styles, so both types of value for the tt(substitute) and tt(glob) styles, so both types of
expansion will normally be performed. expansion will normally be performed.
) )
findex(_history_complete_word) (\e/) findex(_history_complete_word) (\e/))
item(tt(_history_complete_word) (\e/))( item(tt(_history_complete_word) (\e/))(
Complete words from the shell's command history. This uses the Complete words from the shell's command history. This uses the
tt(list), tt(remove-all-dups), tt(sort), and tt(stop) styles. tt(list), tt(remove-all-dups), tt(sort), and tt(stop) styles.