From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 156 invoked from network); 30 Mar 1999 08:42:19 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 30 Mar 1999 08:42:19 -0000 Received: (qmail 3513 invoked by alias); 30 Mar 1999 08:41:49 -0000 Mailing-List: contact zsh-workers-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 5982 Received: (qmail 3398 invoked from network); 30 Mar 1999 08:41:41 -0000 Date: Tue, 30 Mar 1999 10:37:34 +0200 (MET DST) Message-Id: <199903300837.KAA06917@beta.informatik.hu-berlin.de> From: Sven Wischnowsky To: zsh-workers@sunsite.auc.dk In-reply-to: "Andrej Borsenkow"'s message of Mon, 29 Mar 1999 21:19:13 +0400 Subject: PATCH: was RE: PATCH: old lists compstate Andrej Borsenkow wrote: > > I've added a small example completer function `_menu' that may be put > > before the normal `_complete' completer and that gives menucompletion > > implemented fully in shell code (note that this does not work together > > with normal menucompletion). > > bor@itsrm2:~%> compconf > correct_accept 2n > match_original yes > completer _complete:_match > dumpfile /home/bor/.zsh.d/Completion/Core/compinit.dump > correct_prompt correct to: > bor@itsrm2:~%> l /t/s/gl/co > bor@itsrm2:~%> l /tools/src/glib-1./config > bor@itsrm2:~%> l /tools/src/glib-1./config > glib-1.1.15/ glib-1.2.0/ > bor@itsrm2:~%> l /tools/src/glib-1.1.15/config > glib-1.1.15/ glib-1.2.0/ That's without menucompletion, but with automenu, right? > that is O.K., but > > bor@itsrm2:~%> compconf completer=_menu:_complete:_match > bor@itsrm2:~%> l /t/s/gl/co > bor@itsrm2:~%> l /tools/src/glib-1.1.15/config.cache > glib-1.1.15/ glib-1.2.0/ Leaving the cursor at the end is normal menucompletion behavior. Then I was about to say that to have the cursor in the middle, you have to add a `compstate[to_end]=single' for normal menucompletion and a `compstate[to_end]=""' for `_menu' -- when I discovered the bugs fixed by the patch below. And now I can say it. Also, I'd like to point out that I mentioned the (somewhat weird) cursor-positioning `_menu' shows in the mail Andrej was replying to. > BTW to the first example. I have these options: > > noautolist off > bashautolist off > nolistambiguous off > > but list is shown only after the second TAB (as if bashautolist was set). > I'd expect, that with autolist+listambiguous list were shown after the first > TAB already. Actually, I think, it started with bashautolist option ... but > as I used menu completion before ... :-) Nonono. bashautolist shows the list on the *third* TAB if something unambiguous could be inserted on the first TAB. listambiguous shows it if nothing unambiguous could be inserted. And in your example there definitly was a lot unambiguous stuff inserted on the first TAB. > And about compconf ... exaclty in the case above I missed something like > > compconf -i _list completer (meaning insert _list to the element completer) > or, at least, > > compconf completer=_list:$(compconf -l completer) > > or like. I mean, user probably should not see this array at all ... I think he should. For exactly this reason I didn't make it start with an underscore -- with an underscore it would be as invisible as `_comps' ;-) Anyway, I don't like that `-i' option (inserted where? and not every key is a list of words). But the patch at least adds the `-l' option, which makes sense, I think. > P.S. The same with zsh -f; fpath=(....); source ...; compconf > completer=_menu:_complete:_match But I get additional beep (I set nobeep > normally). And here list is shown immediately with the same options as > above. wonders ... Not for me. Unless I set menucomplete (which you haven't listed). And with menucompletion there is no `unambiguous' string ever inserted. The beep comes from `listbeep' being normally set, I think. Bye Sven diff -u os/Zle/zle_tricky.c Src/Zle/zle_tricky.c --- os/Zle/zle_tricky.c Mon Mar 29 11:49:33 1999 +++ Src/Zle/zle_tricky.c Tue Mar 30 10:15:53 1999 @@ -6877,7 +6877,7 @@ /* We are currently not in a menu-completion, * * so set the position variables. */ menupos = wb; - menuwe = (movetoend >= 2 || (movetoend = 1 && !menucmp)); + menuwe = (movetoend >= 2 || (movetoend == 1 && !menucmp)); menuend = we; } /* If we are already in a menu-completion or if we have done a * @@ -6978,7 +6978,7 @@ if (menuwe && m->ripre && isset(AUTOPARAMKEYS)) makeparamsuffix(((m->flags & CMF_PARBR) ? 1 : 0), menuinsc); - if (menucmp && !menuwe) + if ((menucmp && !menuwe) || !movetoend) cs = menuend; } diff -u oc/Core/compinit Completion/Core/compinit --- oc/Core/compinit Mon Mar 29 15:46:13 1999 +++ Completion/Core/compinit Tue Mar 30 10:35:13 1999 @@ -219,18 +219,28 @@ # Arguments may be `foo=bar' to set key `foo' to `bar' or `baz' to # set key `baz' to the empty string. # If no arguments are given, all configurations keys set are displayed. +# With the option `-l' as the first argument, the other arguments are +# taken to be key names and the values for theses keys are printed, one +# per line. compconf() { local i if (( $# )); then - for i; do - if [[ "$i" = *\=* ]]; then - compconfig[${i%%\=*}]="${i#*\=}" - else - compconfig[$i]='' - fi - done + if [[ "$1" = -l ]]; then + shift + for i; do + print $compconfig[$i] + done + else + for i; do + if [[ "$i" = *\=* ]]; then + compconfig[${i%%\=*}]="${i#*\=}" + else + compconfig[$i]='' + fi + done + fi else for i in ${(k)compconfig}; do print ${(r:25:)i} $compconfig[$i] -- Sven Wischnowsky wischnow@informatik.hu-berlin.de