From: Sven Wischnowsky <wischnow@informatik.hu-berlin.de>
To: zsh-workers@sunsite.auc.dk
Subject: PATCH: was RE: PATCH: old lists compstate
Date: Tue, 30 Mar 1999 10:37:34 +0200 (MET DST) [thread overview]
Message-ID: <199903300837.KAA06917@beta.informatik.hu-berlin.de> (raw)
In-Reply-To: "Andrej Borsenkow"'s message of Mon, 29 Mar 1999 21:19:13 +0400
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<TAB>
> bor@itsrm2:~%> l /tools/src/glib-1.<TAB>/config
> bor@itsrm2:~%> l /tools/src/glib-1.<TAB>/config
> glib-1.1.15/ glib-1.2.0/
> bor@itsrm2:~%> l /tools/src/glib-1.1.15<CURSOR>/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<TAB>
> bor@itsrm2:~%> l /tools/src/glib-1.1.15/config.cache <CURSOR>
> 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
next reply other threads:[~1999-03-30 8:42 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
1999-03-30 8:37 Sven Wischnowsky [this message]
1999-03-30 9:34 ` Andrej Borsenkow
1999-03-30 10:07 Sven Wischnowsky
1999-03-30 10:22 ` Andrej Borsenkow
1999-03-30 11:10 Sven Wischnowsky
1999-03-30 12:02 ` Andrej Borsenkow
1999-03-30 12:52 Sven Wischnowsky
1999-03-31 16:28 ` Bart Schaefer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=199903300837.KAA06917@beta.informatik.hu-berlin.de \
--to=wischnow@informatik.hu-berlin.de \
--cc=zsh-workers@sunsite.auc.dk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).