zsh-workers
 help / color / mirror / code / Atom feed
* RE: PATCH: Re: undo in menu selection broken
@ 2000-06-28  9:02 Sven Wischnowsky
  2000-06-28  9:11 ` Andrej Borsenkow
  0 siblings, 1 reply; 5+ messages in thread
From: Sven Wischnowsky @ 2000-06-28  9:02 UTC (permalink / raw)
  To: zsh-workers


Andrej Borsenkow wrote:

> > What this patch does *not* do is fix the behaviour of a-a-i-n-h when
> > there is no match. I was thinking about making it just show some
> > message and let undo bring you back. Or maybe let it stay in the
> > selection it currently is in and show some message. But:
> 
> I think, this is more general problem. I do not like what currently
> happens, when no match is found.
> 
> 1. There is hardly any visual feedback (well, with verbose style and
> group names you get sort of). Good ole compctl had an option to display
> a message in this case ... I do not recall something like this in new
> completion system. Is there any style I can set to simply display "No
> matches found" in this case?
> 
> 2. Something very funny happens if there is no matches and you hit TAB
> several times. The worst is, that line is erased. This hapens in menu
> selection and in normal completion as well. Consider:

This was only a problem with _oldlist. Should be fixed by the patch below.

> > 1) I wouldn't like to hard-wire this message, but adding a parameter
> >    just for this looks kinda weird.
> >    Or maybe just add a ZLS_COLOURS capability for it.
> 
> See above. Style for general use is really welcome (not only for this
> one widget)

Maybe you should just have had a look at the docs after I wrote:

> > 2) Setting the format style for the warnings tag to a value without a
> >    `%d' makes it add the descriptions of the things it tried as
> >    matches which gives a much better output than using `%d'. But with
> >    this, there's never a completion without matches and a-a-i-n-h
> >    happily starts completing the descriptions. So maybe a-a-i-n-h
> >    in menu-selection should set some parameter so that the shell code
> >    can find that out. Even better would be to change the complete
> >    module so that other modules like complist can put things into
> >    $compstate.
> 
> Ahem ... sorry, but I simply do not understand it :-)) I'm speaking from
> a user's point if view ...

Currently you can use:

  zstyle ':completion:*:warnings' format 'No matches for: %d'

which gives you only the explanation. Or you can use:

  zstyle ':completion:*:warnings' format 'No matches for:'

(note: no `%d') which gives you that explanation and below that the
list of descriptions for the things it tried to complete.

So, there is currently no way to make it *not* display the
descriptions. Hm, maybe, the no-`%d' is used seldom enough to allow us 
to make the `add descriptions as "matches"' be controlled by another
style.

But it's cheap, showing those descriptions. All the work for it is
already done.

Bye
 Sven

Index: Completion/Core/_oldlist
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Core/_oldlist,v
retrieving revision 1.6
diff -u -r1.6 _oldlist
--- Completion/Core/_oldlist	2000/05/18 08:59:29	1.6
+++ Completion/Core/_oldlist	2000/06/28 08:56:56
@@ -1,6 +1,6 @@
 #autoload
 
-[[ _matcher_num -gt 1 ]] && return 1
+[[ _matcher_num -gt 1 || $_lastcomp[nmatches] -eq 0 ]] && return 1
 
 local list
 

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


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

* RE: PATCH: Re: undo in menu selection broken
  2000-06-28  9:02 PATCH: Re: undo in menu selection broken Sven Wischnowsky
@ 2000-06-28  9:11 ` Andrej Borsenkow
  0 siblings, 0 replies; 5+ messages in thread
From: Andrej Borsenkow @ 2000-06-28  9:11 UTC (permalink / raw)
  To: Sven Wischnowsky, zsh-workers

>
> This was only a problem with _oldlist. Should be fixed by the
> patch below.
>


Hmm ... it did not change much. Line is still erased and I get

bor@itsrm2% cd
Completing `local directories' or `directories in cdpath'

in the above case.


bor@itsrm2% zstyle -L
zstyle ':completion:*' completer _oldlist _complete _match
zstyle ':completion:*' format 'Completing %d'
zstyle ':completion:*' group-name ''
zstyle ':completion:*' insert-unambiguous true
zstyle ':completion:*' list-colors ''
zstyle ':completion:*' list-prompt '%SAt %p: Hit TAB for more, or the
character to insert%s'
zstyle ':completion:*' match-original both
zstyle ':completion:*' matcher-list '' 'm:{a-z}={A-Z}' 'm:{a-z}={A-Z}
r:|[._-]=* r:|=*' 'm:{a-z}={A-Z} r:|[.-]=** r:|=**'
zstyle ':completion:*' menu 'select=long-list' 'select=0'
zstyle ':completion:*' old-list _match
zstyle ':completion:*' verbose true
zstyle :compinstall filename /home/bor/.zcompletion
zstyle ':completion:*:*:configure:*' tag-order 'options:-with:with\
options options:-other:other\ options' 'options:-without:without\
options'
zstyle ':completion:*:options-with' ignored-patterns '^--with-*'
zstyle ':completion:*:options-without' ignored-patterns '^--without-*'
zstyle ':completion:*:options-other' ignored-patterns '--with(|out)-*'

-andrej


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

* RE: PATCH: Re: undo in menu selection broken
@ 2000-06-28  9:16 Sven Wischnowsky
  0 siblings, 0 replies; 5+ messages in thread
From: Sven Wischnowsky @ 2000-06-28  9:16 UTC (permalink / raw)
  To: zsh-workers


Andrej Borsenkow wrote:

> > This was only a problem with _oldlist. Should be fixed by the
> > patch below.
> 
> Hmm ... it did not change much. Line is still erased and I get
> 
> bor@itsrm2% cd
> Completing `local directories' or `directories in cdpath'
> 
> in the above case.

Sorry. I forgot to point out again that we *are* still thinking about
what to do in menu-selection and a-a-i-n-h when there is no match. The
patch fixes it for non-selecting completion.

At least, I'm still thinking about it. See previous messages for my
suggestions.


Bye
 Sven


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


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

* RE: PATCH: Re: undo in menu selection broken
  2000-06-28  7:28 Sven Wischnowsky
@ 2000-06-28  8:11 ` Andrej Borsenkow
  0 siblings, 0 replies; 5+ messages in thread
From: Andrej Borsenkow @ 2000-06-28  8:11 UTC (permalink / raw)
  To: Sven Wischnowsky, zsh-workers

>
> The patch should also fix the undoing behaviour (Andrej, in your
> example you had typed `.', `/' and then TAB, right? guess what...).
>

Yes.

>
> What this patch does *not* do is fix the behaviour of a-a-i-n-h when
> there is no match. I was thinking about making it just show some
> message and let undo bring you back. Or maybe let it stay in the
> selection it currently is in and show some message. But:
>

I think, this is more general problem. I do not like what currently
happens, when no match is found.

1. There is hardly any visual feedback (well, with verbose style and
group names you get sort of). Good ole compctl had an option to display
a message in this case ... I do not recall something like this in new
completion system. Is there any style I can set to simply display "No
matches found" in this case?

2. Something very funny happens if there is no matches and you hit TAB
several times. The worst is, that line is erased. This hapens in menu
selection and in normal completion as well. Consider:

bor@itsrm2% cd Completion/TAB
bor@itsrm2% cd Completion/AIX/
Completing local directories
AIX/       Bsd/       CVS/       Core/      Linux/     X/
Base/      Builtins/  Commands/  Debian/    User/
      AIX is selected; after `/'
bor@itsrm2% cd Completion/AIX/CVS/
Completing local directories
CVS/
      after `/'
bor@itsrm2% cd Completion/AIX/CVS/
Completing local directories
CVS/
      `/' once again
bor@itsrm2% cd /
Completing `local directories' or `directories in cdpath'

Oops!

This is the case of menu selection, but the same happens in normal
(non-menu) completion as well. The last output is the example of "sort
of feedback" - you can see, that no matches were found. But what I do
not expect, that line is erased.


> 1) I wouldn't like to hard-wire this message, but adding a parameter
>    just for this looks kinda weird.
>    Or maybe just add a ZLS_COLOURS capability for it.

See above. Style for general use is really welcome (not only for this
one widget)

> 2) Setting the format style for the warnings tag to a value without a
>    `%d' makes it add the descriptions of the things it tried as
>    matches which gives a much better output than using `%d'. But with
>    this, there's never a completion without matches and a-a-i-n-h
>    happily starts completing the descriptions. So maybe a-a-i-n-h
>    in menu-selection should set some parameter so that the shell code
>    can find that out. Even better would be to change the complete
>    module so that other modules like complist can put things into
>    $compstate.
>

Ahem ... sorry, but I simply do not understand it :-)) I'm speaking from
a user's point if view ...

-andrej


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

* PATCH: Re: undo in menu selection broken
@ 2000-06-28  7:28 Sven Wischnowsky
  2000-06-28  8:11 ` Andrej Borsenkow
  0 siblings, 1 reply; 5+ messages in thread
From: Sven Wischnowsky @ 2000-06-28  7:28 UTC (permalink / raw)
  To: zsh-workers


Andrej Borsenkow wrote:

> It is probably the result of recent patch and hence partially my fault.
> undo'ing after accept-and-infer-next-history does not goes up but rather
> deletes one character on the line.
> 
> bor@itsrm2% cd ./AIX/
> Completing directory
> AIX/       Bsd/       CVS/       Core/      Linux/     X/
> Base/      Builtins/  Commands/  Debian/    User/
> bor@itsrm2% cd ./AIX/ (after a-a-i-n-h)
> bor@itsrm2% cd .AIX/  (after undo)

This patch makes menu-selection work with only one match when using
a-a-i-n-h. You can't move the cursor very much, for obvious reasons,
but at least it doesn't leave selection.

The patch should also fix the undoing behaviour (Andrej, in your
example you had typed `.', `/' and then TAB, right? guess what...).


What this patch does *not* do is fix the behaviour of a-a-i-n-h when
there is no match. I was thinking about making it just show some
message and let undo bring you back. Or maybe let it stay in the
selection it currently is in and show some message. But:

1) I wouldn't like to hard-wire this message, but adding a parameter
   just for this looks kinda weird.
   Or maybe just add a ZLS_COLOURS capability for it.
2) Setting the format style for the warnings tag to a value without a
   `%d' makes it add the descriptions of the things it tried as
   matches which gives a much better output than using `%d'. But with
   this, there's never a completion without matches and a-a-i-n-h
   happily starts completing the descriptions. So maybe a-a-i-n-h
   in menu-selection should set some parameter so that the shell code
   can find that out. Even better would be to change the complete
   module so that other modules like complist can put things into
   $compstate.

Well, we're getting vom hundertsten ins tausendste here...

Bye
 Sven

Index: Src/Zle/compcore.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Zle/compcore.c,v
retrieving revision 1.33
diff -u -r1.33 compcore.c
--- Src/Zle/compcore.c	2000/06/22 08:42:37	1.33
+++ Src/Zle/compcore.c	2000/06/28 07:27:22
@@ -37,7 +37,7 @@
 /* Flags saying what we have to do with the result. */
 
 /**/
-int useexact, useline, uselist, forcelist, startauto;
+int useexact, useline, uselist, forcelist, iforcemenu, startauto;
 
 /* Non-zero if we should go back to the last prompt. */
 
@@ -349,7 +349,10 @@
 
     if (comppatmatch && *comppatmatch && comppatmatch != opm)
 	haspattern = 1;
-    if (useline < 0)
+    if (iforcemenu) {
+	do_ambig_menu();
+	ret = 0;
+    } else if (useline < 0)
 	ret = selfinsert(zlenoargs);
     else if (!useline && uselist) {
 	/* All this and the guy only wants to see the list, sigh. */
Index: Src/Zle/complist.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Zle/complist.c,v
retrieving revision 1.29
diff -u -r1.29 complist.c
--- Src/Zle/complist.c	2000/06/22 08:42:37	1.29
+++ Src/Zle/complist.c	2000/06/28 07:27:22
@@ -1782,11 +1782,15 @@
 	    menucmp = menuacc = hasoldlist = 0;
 	    minfo.cur = NULL;
 	    fixsuffix();
+	    handleundo();
 	    validlist = 0;
 	    amatches = pmatches = lastmatches = NULL;
 	    invalidate_list();
+	    iforcemenu = 1;
 	    menucomplete(zlenoargs);
-	    if (dat->num < 2 || !minfo.cur || !*(minfo.cur)) {
+	    iforcemenu = 0;
+
+	    if (dat->num < 1 || !minfo.cur || !*(minfo.cur)) {
 		noselect = clearlist = listshown = 1;
 		onlyexpl = 0;
 		zrefresh();
@@ -1821,6 +1825,7 @@
 	    s->origcs = origcs;
 	    s->origll = origll;
 	    accept_last();
+	    handleundo();
 	    do_menucmp(0);
 	    mselect = (*(minfo.cur))->gnum;
 
@@ -1852,6 +1857,7 @@
 	    if (!u)
 		break;
 
+	    handleundo();
 	    cs = 0;
 	    foredel(ll);
 	    spaceinline(l = strlen(u->line));
Index: Src/Zle/compresult.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Zle/compresult.c,v
retrieving revision 1.20
diff -u -r1.20 compresult.c
--- Src/Zle/compresult.c	2000/06/16 07:52:05	1.20
+++ Src/Zle/compresult.c	2000/06/28 07:27:22
@@ -1093,7 +1093,7 @@
 /* This handles the beginning of menu-completion. */
 
 /**/
-static void
+void
 do_ambig_menu(void)
 {
     Cmatch *mc;

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


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

end of thread, other threads:[~2000-06-28  9:16 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-06-28  9:02 PATCH: Re: undo in menu selection broken Sven Wischnowsky
2000-06-28  9:11 ` Andrej Borsenkow
  -- strict thread matches above, loose matches on Subject: below --
2000-06-28  9:16 Sven Wischnowsky
2000-06-28  7:28 Sven Wischnowsky
2000-06-28  8:11 ` 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).