zsh-workers
 help / color / mirror / code / Atom feed
* PATCH: complist doc, and some small problems
@ 1999-06-24  8:41 Peter Stephenson
  0 siblings, 0 replies; 2+ messages in thread
From: Peter Stephenson @ 1999-06-24  8:41 UTC (permalink / raw)
  To: Zsh hackers list

Here's some small changes to the documentation for complist, including
SELECTMIN (which should be ZSELECTMIN, but then so should LISTMAX by
today's rules, so I suppose we have to leave it as it is).

I still have some problems, which by now are rather minor.

1.  Actually, this one isn't minor, but I just discovered it trying to get
    the others to show up with zsh -f.  Any completion (!) with zsh -f
    gives a core dump at the top of printfmt() in zle_tricky.c.  It seems
    the fmt passed is invalid.  Looking back, it seems ilistmatches is
    calling printfmt with `e' which points to a null string.

2.  I finally tracked down my problems with spaces appearing after a
    menu item when selection was used.  It happens if you
    - load new completion
    - setopt menucomplete
    - use menu-select, highlight a directory
    - abort with ^G
    - hit <TAB> again
    - the key point is I'm using _oldlist, so that this sets
      compstate[old_list]=keep to use the existing list.
    - The list items which aren't directories all have a space after them.

      Also with zsh -g it seems to be beeping all the time.  This seems to
      be tied to old_list, too, presumably with LISTBEEP taking effect
      too often.  I've tried this with an old version, and it doesn't
      seem to be related to my feeping changes, nor the other bug I've
      just mentioned.

3.  Also, the documentation advertises that undo works to remove a
    completion.  If this means it's supposed to work invoking undo
    to remove a completion while menu-select is still active, it doesn't.
    It works after you've aborted, of course.

--- Doc/Zsh/mod_complist.yo.doc	Wed Jun 23 09:35:34 1999
+++ Doc/Zsh/mod_complist.yo	Thu Jun 24 10:01:28 1999
@@ -2,18 +2,18 @@
 sect(The complist Module)
 cindex(completion, listing)
 The tt(complist) module offers two extensions to completion listings:
-the possibility to highlight matches in such a list and a different
+the ability to highlight matches in such a list and a different
 style of menu-completion.
 
 subsect(Parameters)
-For both extensions one has to describe how matches are highlighted by 
-setting one of the parameters tt(ZLS_COLORS) or tt(ZLS_COLOURS). The
-format of the value of these parameters is the same as used by the GNU
-version of the tt(ls) command: a colon-separated list of
-specifications of the form `var(name)=var(value)'. The var(name)
-may be one of the following strings, most of which specify file-types
-for which the var(value) will be used. The strings and their default
-values are:
+For both extensions one of the parameters tt(ZLS_COLORS) or tt(ZLS_COLOURS)
+must be set, even if the value is empty (which uses all the default values
+given below). These describe how matches are highlighted. The format of the
+value of these parameters is the same as used by the GNU version of the
+tt(ls) command: a colon-separated list of specifications of the form
+`var(name)=var(value)'. The var(name) may be one of the following strings,
+most of which specify file-types for which the var(value) will be used. The
+strings and their default values are:
 
 startitem()
 item(tt(no 0))(
@@ -77,39 +77,43 @@
 
 subsect(Menu selection)
 The tt(complist) module also offers a different style of selecting
-matches from a list called menu-selection. It can be invoked by using
-the widget tt(menu-select) defined by the module or by setting the
-parameter tt(ZLS_SELECT). In the latter case menu-selection is used
-whenever menu-completion is started (because a widget such as
-tt(menu-complete) was used or because of tt(AUTO_MENU) being set).
+matches from a list called menu-selection. It can be invoked directly by
+the widget tt(menu-select) defined by the module.  Alternatively,
+the parameter tt(SELECTMIN) can be set to an integer giving the minimum
+number of matches which must be present before menu selection is
+automatically turned on.  This second method requires that menu completion
+be started, either directly from a widget such as tt(menu-complete), or due
+to one of the options tt(MENU_COMPLETE) or tt(AUTO_MENU) being set.  If
+tt(SELECTMIN) is set, but is 0, 1 or empty, menu selection will always be
+started during menu completion if the completion is ambiguous.
 
 After menu-selection is started, the matches will be listed. The
 matches to insert into the command line can be selected from this
 list. In the list one match is highlighted using the value for tt(ma)
 from the tt(ZLS_COLORS) or tt(ZLS_COLOURS) parameter. The default
-value for this it `tt(7)' which makes the selected match be
+value for this it `tt(7)' which forces the selected match to be
 highlighted using standout mode on a vt100 compatible terminal.
 
-Selecting matches is done by moving the mark around using the zle
-movement functions. The zle functions tt(send-break) and
-tt(accept-line) can be used to leave menu-selection, leaving the match 
-currently inserted into the line in place. The functions
-tt(accept-and-hold) and tt(accept-and-menu-complete) can be used to
-accept the match currently inserted and continue inserting matches
-after that. Matches inserted this way can be removed by invoking the
-tt(undo) function. Keys bound to one of the completion functions make
-the next (or, in case of tt(reverse-menu-complete), the previous)
-match be inserted and the tt(redisplay) and tt(clear-screen) functions 
-work as usual without leaving menu-selection. Any other zle function
-leaves menu-selection and makes that function be executed.
+Selecting matches is done by moving the mark around using the zle movement
+functions. The zle functions tt(send-break) and tt(accept-line) can be used
+to leave menu-selection, leaving the match currently inserted into the line
+in place. The functions tt(accept-and-hold) and
+tt(accept-and-menu-complete) can be used to accept the match currently
+inserted and continue inserting matches after that. Matches inserted this
+way can be removed by invoking the tt(undo) function. Keys bound to one of
+the completion functions will cycle to the next (or, in case of
+tt(reverse-menu-complete), the previous) match, and the tt(redisplay) and
+tt(clear-screen) functions work as usual without leaving
+menu-selection. Any other zle function leaves menu-selection and executes
+that function.
 
 During this selection the widget uses the keymap tt(menuselect). Any
 key that is not defined in this keymap or that is bound to
 tt(undefined-key) is looked up in the keymap currently selected. This
 is used to ensure that the most important keys used during selection
-have sensible default (namely the cursor keys, return, and TAB). But
-the tt(menuselect) is user-visible and other keys can be defined in it 
-using the tt(bindkey) builtin command (see
+have sensible default (namely the cursor keys, return, and TAB). However,
+keys in the the tt(menuselect) keymap can be modified directly using the
+tt(bindkey) builtin command (see
 ifzman(zmanref(zshmodules))\
 ifnzman(noderef(The zle Module))\
 ).

-- 
Peter Stephenson <pws@ibmth.df.unipi.it>       Tel: +39 050 844536
WWW:  http://www.ifh.de/~pws/
Dipartimento di Fisica, Via Buonarroti 2, 56127 Pisa, Italy


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

* Re: PATCH: complist doc, and some small problems
@ 1999-06-24  9:55 Sven Wischnowsky
  0 siblings, 0 replies; 2+ messages in thread
From: Sven Wischnowsky @ 1999-06-24  9:55 UTC (permalink / raw)
  To: zsh-workers


Peter Stephenson wrote:

> I still have some problems, which by now are rather minor.
> 
> 1.  Actually, this one isn't minor, but I just discovered it trying to get
>     the others to show up with zsh -f.  Any completion (!) with zsh -f
>     gives a core dump at the top of printfmt() in zle_tricky.c.  It seems
>     the fmt passed is invalid.  Looking back, it seems ilistmatches is
>     calling printfmt with `e' which points to a null string.

Forgot to change the second argument of ilistmatches().

> 2.  I finally tracked down my problems with spaces appearing after a
>     menu item when selection was used.  It happens if you
>     - load new completion
>     - setopt menucomplete
>     - use menu-select, highlight a directory
>     - abort with ^G
>     - hit <TAB> again
>     - the key point is I'm using _oldlist, so that this sets
>       compstate[old_list]=keep to use the existing list.
>     - The list items which aren't directories all have a space after them.

That's the compstate[insert] behaviour I described when I implemented
it. I'm pretty sure I asked if this space should be there or not at
the time, and here seems to be the answer to that question.
So the patch makes the space not be inserted in this case.
Btw. I was thinking about cases where one selects one match from those 
generated and wants to insert only that -- leaving completion. In such 
a case the space is the right thing, so I may enhance the use of the
insert key some day to be able to select both.

>       Also with zsh -g it seems to be beeping all the time.  This seems to
>       be tied to old_list, too, presumably with LISTBEEP taking effect
>       too often.  I've tried this with an old version, and it doesn't
>       seem to be related to my feeping changes, nor the other bug I've
>       just mentioned.

That test at the end of do_ambiguous() is one of the things I started
to dislike long ago...

> 3.  Also, the documentation advertises that undo works to remove a
>     completion.  If this means it's supposed to work invoking undo
>     to remove a completion while menu-select is still active, it doesn't.
>     It works after you've aborted, of course.

Hm, works for me (note: only completions inserted with
accept-and-{menu-complete,hold}).

Bye
 Sven

diff -u os/Zle/complist.c Src/Zle/complist.c
--- os/Zle/complist.c	Thu Jun 24 11:08:17 1999
+++ Src/Zle/complist.c	Thu Jun 24 11:22:47 1999
@@ -623,14 +623,14 @@
 domenuselect(Hookdef dummy, Chdata dat)
 {
     Cmatch **p;
-    Cmgroup amatches = dat->matches, *pg;
+    Cmgroup *pg;
     Thingy cmd;
     Menustack u = NULL;
     int i = 0;
     char *s;
 
     if (getcols(NULL) || (dummy && (!(s = getsparam("SELECTMIN")) ||
-				    dat->num < atoi(s))))
+				    (dat && dat->num < atoi(s)))))
 	return 1;
 
     selectlocalmap(mskeymap);
diff -u os/Zle/zle_tricky.c Src/Zle/zle_tricky.c
--- os/Zle/zle_tricky.c	Thu Jun 24 11:08:19 1999
+++ Src/Zle/zle_tricky.c	Thu Jun 24 11:45:09 1999
@@ -7477,7 +7477,8 @@
     if (isset(LISTBEEP))
 	ret = 1;
     if (uselist && (usemenu != 2 || (!showinglist && !oldlist)) &&
-	(!showinglist || (usemenu == 3 && !oldlist)) &&
+	((!showinglist && (!listshown || !oldlist)) ||
+	 (usemenu == 3 && !oldlist)) &&
 	(smatches >= 2 || (compforcelist && *compforcelist)))
 	showinglist = -2;
     return ret;
@@ -7652,7 +7653,7 @@
 	    inststrlen(&(m->autoq), 1, 1);
 	    minfo.insc++;
 	}
-	if (!menucmp) {
+	if (!menucmp && usemenu != 3) {
 	    inststrlen(" ", 1, 1);
 	    minfo.insc++;
 	    if (minfo.we)
@@ -7897,7 +7898,7 @@
 
 /**/
 int
-ilistmatches(Hookdef dummy, Cmgroup amatches)
+ilistmatches(Hookdef dummy, Chdata dat)
 {
     Cmgroup g;
     Cmatch *p, m;
@@ -8150,6 +8151,7 @@
     struct cmgroup dg;
     int vl = validlist, sm = smatches;
     char *oclp = complastprompt;
+    Cmgroup am = amatches;
 
     if (listshown)
 	showagain = 1;
@@ -8159,7 +8161,9 @@
     validlist = 1;
     memset(&dg, 0, sizeof(struct cmgroup));
     dg.ylist = (char **) makearray(l, 1, &(dg.lcount), NULL);
-    ilistmatches(NULL, &dg);
+    amatches = &dg;
+    ilistmatches(NULL, NULL);
+    amatches = am;
 
     validlist = vl;
     smatches = sm;

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


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

end of thread, other threads:[~1999-06-24  9:55 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-06-24  8:41 PATCH: complist doc, and some small problems Peter Stephenson
1999-06-24  9:55 Sven Wischnowsky

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