zsh-workers
 help / color / mirror / code / Atom feed
* Re: pws-23: RE: _match and auto menu with multipath again
@ 1999-06-21 12:38 Sven Wischnowsky
  0 siblings, 0 replies; 3+ messages in thread
From: Sven Wischnowsky @ 1999-06-21 12:38 UTC (permalink / raw)
  To: zsh-workers


Andrej Borsenkow wrote:

> Looks like a problem with list redisplay. Completion code thinks, it has still
> old valid list.

I needed some time to play with configuration keys until I could
reproduce this...
When switching to menucompletion it sometimes didn't show a newly
generated list because it though it had just started automenu using
the old list of matches.

Bye
 Sven

diff -u os/Zle/zle_tricky.c Src/Zle/zle_tricky.c
--- os/Zle/zle_tricky.c	Mon Jun 21 12:49:49 1999
+++ Src/Zle/zle_tricky.c	Mon Jun 21 14:32:17 1999
@@ -7486,7 +7486,7 @@
      * if it is needed.                                                     */
     if (isset(LISTBEEP))
 	feep();
-    if (uselist && usemenu != 2 &&
+    if (uselist && (usemenu != 2 || (!showinglist && !oldlist)) &&
 	(!showinglist || (usemenu == 3 && !oldlist)) &&
 	(smatches >= 2 || (compforcelist && *compforcelist)))
 	showinglist = -2;

--
Sven Wischnowsky                         wischnow@informatik.hu-berlin.de


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: pws-23: RE: _match and auto menu with multipath again
@ 1999-06-21 11:51 Sven Wischnowsky
  0 siblings, 0 replies; 3+ messages in thread
From: Sven Wischnowsky @ 1999-06-21 11:51 UTC (permalink / raw)
  To: zsh-workers


Andrej Borsenkow wrote:

> > Does any of these do what you want? Note that setting `match_insert=unambig'
> > may sometimes remove a short pattern if enough components further up
> > the path were expanded. This is a bit ugly, yes, but I can't think of
> > an easy way to find out where that precious pattern is which one might
> > want to have preserved.
> 
> Thinking more and more about it: what is the reason for _match to automatically
> start menu completion at all (apart from compatibility with old zsh, that can be
> preserved with configuration key).

Because a pattern may match anything -- we can not be sure that all
results have some common prefix (or other common string).

> Think about it:
> 
> 1. We complete /u/l/s/z/f -> /usr/local/share/zsh/functions
> This is actually the same as if we completed /u*/l*/s*/z*/f* - and is
> interpreted and implemented this way.

Not really: every path component is matched using normal completion
matching rules. Nowadays we don't use patterns like `/u*/l*' any more.

> What happens is, that unambiguous prefix
> is replaced and first ambiguous part is replaced with the largest common prefix;
> remaining parts retain there (implicit) glob pattern. That is, we get something
> like
> 
> /usr/local/s/z*/f*
> share status ...

No, the code expands the remaining pathname components, too (if possible).

> how does it differ from
> 
> 2. We complete /u/l/s/z/f*s -> /usr/local/share/zsh/functions ?
> In no way, except, that we know better some patterns (more than only initial
> character) and thus are able to reduce possible matches.

See above, and: for the completion code there is a big difference
between working on a pattern and working on a normal string. Only in
the latter case do we use the match specs (-M) -- and I really think
it should be so because if you type a pattern, you probably know
better what you want than the completion code.

> Note, that patterns are
> often longer than most common prefix - typing /u/l/lib*X* will typically leave
> me with just 'lib' prefix.

I know, that's why I pointed out that the result is sometimes ugly.

> So, I think, that either match_insert should be changed to always insert prefix
> (irrespectively of length) or we need additional config key to force it.

Feel free to implement something in _match that preserves the pattern
parts of a pathname. Dunno when I find time for this... don't hold
your breath.

> And about cutrrent behaviour:
> 
> compconf correct_accept='2n'
> compconf match_original='yes'
> compconf completer='_complete:_match'
> compconf dumpfile='/home/bor/.zcompdump'
> compconf path_cursor='yes'
> compconf match_insert='unambig'
> compconf correct_prompt='correct to:'
> bor@itsrm2:~%> l /u/l/lib*X*<TAB>
> bor@itsrm2:~%> l /usr/lib/lib*X*
> lib/     lib64s/         ^ cursor here
> 
> That is correct and is what I expected. But simply pressing TAB once more
> results in
> 
> bor@itsrm2:~%> l /usr/lib/libX11.a
> lib/     lib64s/
> 
> While if I press any cursor movement key and then TAB I get
> 
> bor@itsrm2:~%> l /usr/lib/lib*X*
> lib/     lib64s/          ^ cursor here (after cursor-right)
> bor@itsrm2:~%> l /usr/lib/libX11.a
> libX11.a@           libXaw.so.6.1@      libXmSni.so.3.0@    libXpm.so.3.4@
> libX11.so@          libXdUtils.so.3.1@  libXmu.a@           libXpm.so.4.6@
> .................... (long list),

Completion was started and _path_files skipped over pathname
components that really exist, matches are the files matching lib*X* in 
/usr/lib. (The list is what you have in /usr/lib, right? If so, then
this is correct behavior.)

> or if I explicitly enter '6'
> 
> bor@itsrm2:~%> l /usr/lib/lib*X*
> lib/     lib64s/         ^ cursor here
> bor@itsrm2:~%> l /usr/lib6/lib*X*
> lib/     lib64s/          ^ cursor here and TAB
> bor@itsrm2:~%> l /usr/lib64s/libX11.a
> libX11.a@          libXaw.so.6.1@     libXmu.so@         libXpm.so@
> libX11.so@         libXdmcp.a@        libXmu.so.6.0@     libXpm.so.3.4@
> ........................

If these are the files in /usr/lib642 matching lib*X*, then this is
correct again (see above).

If not, then I can't reproduce this bug. But maybe I understood you
completely wrong?

Bye
 Sven


--
Sven Wischnowsky                         wischnow@informatik.hu-berlin.de


^ permalink raw reply	[flat|nested] 3+ messages in thread

* pws-23: RE: _match and auto menu with multipath again
  1999-06-17  8:37 Sven Wischnowsky
@ 1999-06-21  7:53 ` Andrej Borsenkow
  0 siblings, 0 replies; 3+ messages in thread
From: Andrej Borsenkow @ 1999-06-21  7:53 UTC (permalink / raw)
  To: Sven Wischnowsky, zsh-workers

>
> Does any of these do what you want? Note that setting `match_insert=unambig'
> may sometimes remove a short pattern if enough components further up
> the path were expanded. This is a bit ugly, yes, but I can't think of
> an easy way to find out where that precious pattern is which one might
> want to have preserved.
>


Thinking more and more about it: what is the reason for _match to automatically
start menu completion at all (apart from compatibility with old zsh, that can be
preserved with configuration key). Think about it:

1. We complete /u/l/s/z/f -> /usr/local/share/zsh/functions
This is actually the same as if we completed /u*/l*/s*/z*/f* - and is
interpreted and implemented this way. What happens is, that unambiguous prefix
is replaced and first ambiguous part is replaced with the largest common prefix;
remaining parts retain there (implicit) glob pattern. That is, we get something
like

/usr/local/s/z*/f*
share status ...

how does it differ from

2. We complete /u/l/s/z/f*s -> /usr/local/share/zsh/functions ?
In no way, except, that we know better some patterns (more than only initial
character) and thus are able to reduce possible matches. Note, that patterns are
often longer than most common prefix - typing /u/l/lib*X* will typically leave
me with just 'lib' prefix.

So, I think, that either match_insert should be changed to always insert prefix
(irrespectively of length) or we need additional config key to force it.

And about cutrrent behaviour:

compconf correct_accept='2n'
compconf match_original='yes'
compconf completer='_complete:_match'
compconf dumpfile='/home/bor/.zcompdump'
compconf path_cursor='yes'
compconf match_insert='unambig'
compconf correct_prompt='correct to:'
bor@itsrm2:~%> l /u/l/lib*X*<TAB>
bor@itsrm2:~%> l /usr/lib/lib*X*
lib/     lib64s/         ^ cursor here

That is correct and is what I expected. But simply pressing TAB once more
results in

bor@itsrm2:~%> l /usr/lib/libX11.a
lib/     lib64s/

While if I press any cursor movement key and then TAB I get

bor@itsrm2:~%> l /usr/lib/lib*X*
lib/     lib64s/          ^ cursor here (after cursor-right)
bor@itsrm2:~%> l /usr/lib/libX11.a
libX11.a@           libXaw.so.6.1@      libXmSni.so.3.0@    libXpm.so.3.4@
libX11.so@          libXdUtils.so.3.1@  libXmu.a@           libXpm.so.4.6@
.................... (long list),
or if I explicitly enter '6'

bor@itsrm2:~%> l /usr/lib/lib*X*
lib/     lib64s/         ^ cursor here
bor@itsrm2:~%> l /usr/lib6/lib*X*
lib/     lib64s/          ^ cursor here and TAB
bor@itsrm2:~%> l /usr/lib64s/libX11.a
libX11.a@          libXaw.so.6.1@     libXmu.so@         libXpm.so@
libX11.so@         libXdmcp.a@        libXmu.so.6.0@     libXpm.so.3.4@
........................

Looks like a problem with list redisplay. Completion code thinks, it has still
old valid list. And this also illustrates my point - in this case I do not want
menu completion - I just want list to be dislpayed. But, unfortunatley,
length(lib) < length(lib*X*) :-(

/andrej

Just in case:
6731, 6732 applied



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~1999-06-21 12:38 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-06-21 12:38 pws-23: RE: _match and auto menu with multipath again Sven Wischnowsky
  -- strict thread matches above, loose matches on Subject: below --
1999-06-21 11:51 Sven Wischnowsky
1999-06-17  8:37 Sven Wischnowsky
1999-06-21  7:53 ` pws-23: " Andrej Borsenkow

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).