Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
PATCH: Re: non-symmetric behavior of _message and compadd
- X-seq: zsh-workers 11188
- From: Sven Wischnowsky <wischnow@xxxxxxxxxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxxxxxxxxx
- Subject: PATCH: Re: non-symmetric behavior of _message and compadd
- Date: Fri, 5 May 2000 13:17:55 +0200 (MET DST)
- In-reply-to: Tanaka Akira's message of 05 May 2000 18:16:53 +0900
- Mailing-list: contact zsh-workers-help@xxxxxxxxxxxxxx; run by ezmlm
Tanaka Akira wrote:
> Z(4):akr@serein% Src/zsh -f
> serein% bindkey -e; autoload -U compinit; compinit -D
> serein% zstyle ':completion*:messages' format %d
> serein% compdef _tst1 tst1; _tst1 () { compadd c; _message m }
> serein% compdef _tst2 tst2; _tst2 () { _message m; compadd c }
>
> serein% tst1 <TAB>
> ->
> serein% tst1 c
>
> serein% tst2 <TAB>
> m
> c
>
> The completion behavior depends the order of compadd and _message. If
> compadd is preceded, `c' is completed. If _message is preceded, the
> list is showed. Is this intentional? I like former, though.
Of course, that's how it should have worked. I didn't think of this
when I added that -x option. But what really makes me wonder is why I
hadn't implemented it from the beginning as in the patch below...
Bye
Sven
Index: Completion/Core/_main_complete
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Core/_main_complete,v
retrieving revision 1.12
diff -u -r1.12 _main_complete
--- Completion/Core/_main_complete 2000/05/04 07:44:21 1.12
+++ Completion/Core/_main_complete 2000/05/05 11:16:19
@@ -21,7 +21,7 @@
local func funcs ret=1 tmp _compskip format nm \
_completers _completer _completer_num curtag \
- _matchers _matcher _matcher_num _comp_tags \
+ _matchers _matcher _matcher_num _comp_tags _comp_mesg \
context state line opt_args val_args curcontext="$curcontext" \
_last_nmatches=-1 _last_menu_style _def_menu_style _menu_style sel \
_saved_exact="${compstate[exact]}" \
@@ -174,6 +174,9 @@
fi
fi
fi
+elif [[ nm -eq 0 && -n "$_comp_mesg" ]]; then
+ compstate[insert]=''
+ compstate[list]='list force'
elif [[ nm -eq 0 &&
$#_lastdescr -ne 0 && $compstate[old_list] != keep ]] &&
zstyle -s ":completion:${curcontext}:warnings" format format; then
Index: Completion/Core/_message
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Core/_message,v
retrieving revision 1.2
diff -u -r1.2 _message
--- Completion/Core/_message 2000/05/02 10:30:41 1.2
+++ Completion/Core/_message 2000/05/05 11:16:19
@@ -16,8 +16,5 @@
if [[ -n "$format$raw" ]]; then
[[ -z "$raw" ]] && zformat -f format "$format" "d:$1" "${(@)argv[2,-1]}"
compadd -x "$format"
- if [[ $compstate[nmatches] -eq 0 ]]; then
- compstate[list]='list force'
- compstate[insert]=''
- fi
+ _comp_mesg=yes
fi
--
Sven Wischnowsky wischnow@xxxxxxxxxxxxxxxxxxxxxxx
Messages sorted by:
Reverse Date,
Date,
Thread,
Author