From: Sven Wischnowsky <wischnow@informatik.hu-berlin.de>
To: zsh-workers@math.gatech.edu
Subject: PATCH: was Re: REC_EXACT and AUTO_MENU, and compctl -U too (Part III)
Date: Tue, 23 Jun 1998 14:52:23 +0200 (MET DST) [thread overview]
Message-ID: <199806231252.OAA11276@beta.informatik.hu-berlin.de> (raw)
In-Reply-To: "Bart Schaefer"'s message of Fri, 19 Jun 1998 11:14:59 -0700
Bart Schaefer wrote:
>
> One thing that's annoyed me for a very long time is the interaction of
> recexact with automenu. Suppose I have both options set.
>
> zsh% /usr/li
>
> The possible completions at this point are /usr/lib and /usr/libexec. I
> press TAB (which is bound to expand-or-complete).
>
> zsh% /usr/lib
>
> This is not a completion; it's the unique prefix of a menu completion, or
> it would be in most circumstances. With recexact, though, when I press
> TAB again expecting to menucomplete to libexec, I instead get /usr/lib/
> and now I can only complete within that directory.
>
> What I'd like is to have recexact behavior when I type the entire prefix
> and automenu behavior when zsh supplies the prefix.
>
And here is my attempt to solve this (the patch looks bigger than it is).
The patch makes do_ambiguous() test if the inserted prefix/suffix is
as long as the shortest match and RECEXACT is set (this is the normal
test for using RECEXACT). If so, we make AUTOMENU start immediatly.
There is also a little change to ignore LISTAMBIGUOUS in this case, so
that the listing is shown and AUTOMENU started even if it is set.
Well... this *seems* to work for various settings of AUTOMENU,
RECEXACT, and LISTAMBIGUOUS and I'm quite positive about it, but maybe
someone finds a option/completion combination which defeats this
(although doing it in this place of the code should make it quiute
stable).
Bye
Sven
*** Src/Zle/zle_tricky.c.old Mon Jun 22 08:55:46 1998
--- Src/Zle/zle_tricky.c Tue Jun 23 14:40:29 1998
***************
*** 3237,3243 ****
do_ambiguous(void)
{
int p = (usemenu || ispattern), atend = (cs == we);
! int inv = 0;
menucmp = 0;
--- 3238,3244 ----
do_ambiguous(void)
{
int p = (usemenu || ispattern), atend = (cs == we);
! int inv = 0, am = 0;
menucmp = 0;
***************
*** 3272,3283 ****
inststrlen(firstm + strlen(firstm) - ae, 0, ae);
if(ab || (ae && !atend))
inv = 1;
/* If the LIST_AMBIGUOUS option (meaning roughly `show a list only *
* if the completion is completely ambiguous') is set, and some *
* prefix was inserted, return now, bypassing the list-displaying *
* code. On the way, invalidate the list and note that we don't *
* want to enter an AUTO_MENU imediately. */
! if(isset(LISTAMBIGUOUS) && inv) {
invalidatelist();
lastambig = 0;
return;
--- 3273,3291 ----
inststrlen(firstm + strlen(firstm) - ae, 0, ae);
if(ab || (ae && !atend))
inv = 1;
+
+ /* If REC_EXACT and AUTO_MENU are set and what we inserted is an *
+ * exact match, we want to start menu completion now. Otherwise *
+ * on the next call to completion the inserted string would be *
+ * taken as a match and no menu completion would be started. */
+ if (isset(RECEXACT) && (atend ? ab : ab + ae) == shortl) am = 1;
+
/* If the LIST_AMBIGUOUS option (meaning roughly `show a list only *
* if the completion is completely ambiguous') is set, and some *
* prefix was inserted, return now, bypassing the list-displaying *
* code. On the way, invalidate the list and note that we don't *
* want to enter an AUTO_MENU imediately. */
! if(isset(LISTAMBIGUOUS) && inv && !am) {
invalidatelist();
lastambig = 0;
return;
***************
*** 3291,3296 ****
--- 3299,3305 ----
showinglist = -2;
if(inv)
invalidatelist();
+ if (am) lastambig = 1;
}
/* This is a stat that ignores backslashes in the filename. The `ls' *
--
Sven Wischnowsky wischnow@informatik.hu-berlin.de
reply other threads:[~1998-06-23 13:00 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=199806231252.OAA11276@beta.informatik.hu-berlin.de \
--to=wischnow@informatik.hu-berlin.de \
--cc=zsh-workers@math.gatech.edu \
/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).