zsh-workers
 help / color / mirror / code / Atom feed
* Re: Extra List in 3.1.6-test1
@ 1999-07-15  8:51 Sven Wischnowsky
  0 siblings, 0 replies; 3+ messages in thread
From: Sven Wischnowsky @ 1999-07-15  8:51 UTC (permalink / raw)
  To: zsh-workers


Vin Shelton wrote:

> I'm getting an extra list with ambiguous completion in 3.1.6-test1.
> 3.1.6-test1 with no patches applied.  Start with a clear screen.

This was a bug. The test at the end of do_ambiguous() thought there
wasn't a list. The patch makes listshown be set to 1 if a list is
below the prompt and to -1 if one is above it, so that we can test for 
both and zrefresh() is able to set listshown=0 only if it really just
cleared the list.

This also made me test noalwayslastprompt with complist for the first
time (ahem). So this patch also avoids using menu-selection if no
alwayslastprompt behaviour was requested (one way or another).


Bye
 Sven

diff -u os/Zle/complist.c Src/Zle/complist.c
--- os/Zle/complist.c	Thu Jul 15 09:49:52 1999
+++ Src/Zle/complist.c	Thu Jul 15 10:42:06 1999
@@ -308,7 +308,7 @@
     Cmatch *p, m;
     Cexpl *e;
     int nlines = 0, ncols, nlist = 0, longest = 1, pnl = 0, opl = 0;
-    int of = isset(LISTTYPES);
+    int of = isset(LISTTYPES), cf;
     int mc, ml = 0, cc, hasm = 0, cl;
     struct listcols col;
 
@@ -394,8 +394,10 @@
 			nlines += 1 + ((1 + niceztrlen(m->str)) / columns);
 	}
     }
-    if (!nlines) {
+    cf = (isset(USEZLE) && !termflags && complastprompt && *complastprompt);
+    if (!nlines || (mselect >= 0 && (!cf || (nlines + nlnct - 1) >= lines))) {
 	showinglist = listshown = 0;
+	noselect = 1;
 	return 1;
     }
     /* Set the cursor below the prompt. */
@@ -404,8 +406,7 @@
     trashzle();
     showinglist = listshown = 0;
 
-    clearflag = (isset(USEZLE) && !termflags &&
-		 complastprompt && *complastprompt);
+    clearflag = cf;
 
     /* Maybe we have to ask if the user wants to see the list. */
     if ((!minfo.cur || !minfo.asked) &&
@@ -657,20 +658,20 @@
 	    pnl = 1;
 	g = g->next;
     }
-
     if (clearflag) {
 	/* Move the cursor up to the prompt, if always_last_prompt *
 	 * is set and all that...                                  */
 	if ((nlines += nlnct - 1) < lines) {
 	    tcmultout(TCUP, TCMULTUP, nlines);
 	    showinglist = -1;
-	    listshown = 1;
 	} else
 	    clearflag = 0, putc('\n', shout);
     } else
 	putc('\n', shout);
+    listshown = (clearflag ? 1 : -1);
     if (!hasm || nlines >= lines)
 	noselect = 1;
+
     return noselect;
 }
 
diff -u os/Zle/zle_refresh.c Src/Zle/zle_refresh.c
--- os/Zle/zle_refresh.c	Thu Jul 15 09:49:53 1999
+++ Src/Zle/zle_refresh.c	Thu Jul 15 10:28:44 1999
@@ -53,7 +53,8 @@
 /**/
 int showinglist;
 
-/* Non-zero if a completion list was displayed. */
+/* > 0 if a completion list is displayed below the prompt,
+ * < 0 if a list is displayed above the prompt. */
 
 /**/
 int listshown;
@@ -265,7 +266,7 @@
     if (inlist)
 	return;
 
-    if (clearlist && listshown) {
+    if (clearlist && listshown > 0) {
 	if (tccan(TCCLEAREOD)) {
 	    int ovln = vln, ovcs = vcs;
 	    char *nb = nbuf[vln];
@@ -331,7 +332,8 @@
                 tcout(TCCLEAREOD);
             else
                 cleareol = 1;   /* request: clear to end of line */
-	    listshown = 0;
+	    if (listshown > 0)
+		listshown = 0;
 	}
         if (t0 > -1)
             olnct = t0;
diff -u os/Zle/zle_tricky.c Src/Zle/zle_tricky.c
--- os/Zle/zle_tricky.c	Thu Jul 15 09:49:54 1999
+++ Src/Zle/zle_tricky.c	Thu Jul 15 10:27:26 1999
@@ -7520,11 +7520,13 @@
      * if it is needed.                                                     */
     if (isset(LISTBEEP))
 	ret = 1;
-    if (uselist && (usemenu != 2 || (!showinglist && !oldlist)) &&
+
+    if (uselist && (usemenu != 2 || (!listshown && !oldlist)) &&
 	((!showinglist && (!listshown || !oldlist)) ||
 	 (usemenu == 3 && !oldlist)) &&
 	(smatches >= 2 || (compforcelist && *compforcelist)))
 	showinglist = -2;
+
     return ret;
 }
 
@@ -8174,18 +8176,18 @@
 	    pnl = 1;
 	g = g->next;
     }
-
     if (clearflag) {
 	/* Move the cursor up to the prompt, if always_last_prompt *
 	 * is set and all that...                                  */
 	if ((nlines += nlnct - 1) < lines) {
 	    tcmultout(TCUP, TCMULTUP, nlines);
 	    showinglist = -1;
-	    listshown = 1;
 	} else
 	    clearflag = 0, putc('\n', shout);
     } else
 	putc('\n', shout);
+    listshown = (clearflag ? 1 : -1);
+
     return 0;
 }
 
diff -u od/Zsh/mod_complist.yo Doc/Zsh/mod_complist.yo
--- od/Zsh/mod_complist.yo	Thu Jul 15 09:49:59 1999
+++ Doc/Zsh/mod_complist.yo	Thu Jul 15 10:50:26 1999
@@ -79,7 +79,12 @@
 
 subsect(Menu selection)
 The tt(complist) module also offers an alternative style of selecting
-matches from a list, called menu-selection. It can be invoked directly by
+matches from a list, called menu-selection, which can be used if the
+shell is set up to return to the last prompt after showing a
+completion list (see the tt(ALWAYS_LAST_PROMPT) option in
+ifzman(zmanref(zshoptions))\
+ifnzman(noderef(Options))\
+). 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, which give the
 minimum number of matches that must be present before menu selection is

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


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

* Re: Extra List in 3.1.6-test1
  1999-07-14 16:08 Vin Shelton
@ 1999-07-15  2:34 ` Vin Shelton
  0 siblings, 0 replies; 3+ messages in thread
From: Vin Shelton @ 1999-07-15  2:34 UTC (permalink / raw)
  To: ZSH workers mailing list

Apparently, the bug/feature I observed was introduced in pws-24.
pws-23 does not exhibit this, at least on my linux-2.2 686 box.

  - vin


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

* Extra List in 3.1.6-test1
@ 1999-07-14 16:08 Vin Shelton
  1999-07-15  2:34 ` Vin Shelton
  0 siblings, 1 reply; 3+ messages in thread
From: Vin Shelton @ 1999-07-14 16:08 UTC (permalink / raw)
  To: ZSH workers mailing list

I'm getting an extra list with ambiguous completion in 3.1.6-test1.
3.1.6-test1 with no patches applied.  Start with a clear screen.

: ~ Wed 14 11:56; zsh -f
dusk1% uname -a
SunOS dusk1 5.5.1 Generic sun4m sparc
dusk1% echo $ZSH_VERSION
3.1.6-test-1
dusk1% setopt noalwayslastprompt
dusk1% echo $ZSH_<TAB>

# So far, so good.
# This results in the screen looking like:

: ~ Wed 14 11:56; zsh -f
dusk1% uname -a
SunOS dusk1 5.5.1 Generic sun4m sparc
dusk1% echo $ZSH_VERSION
3.1.6-test-1
dusk1% setopt noalwayslastprompt
dusk1% echo $ZSH_
ZSH_NAME      ZSH_VERSION   
dusk1% echo $ZSH_


# When I now press another <TAB>, I get 'ZSH_NAME', offered as the first 
# completion, but I get an additional list, so the whole screen now
# looks like this:

: ~ Wed 14 11:56; zsh -f
dusk1% uname -a
SunOS dusk1 5.5.1 Generic sun4m sparc
dusk1% echo $ZSH_VERSION
3.1.6-test-1
dusk1% setopt noalwayslastprompt
dusk1% echo $ZSH_
ZSH_NAME      ZSH_VERSION   
dusk1% echo $ZSH_NAME
ZSH_NAME      ZSH_VERSION   
dusk1% echo $ZSH_NAME


I didn't used to get the extra list; was the change intentional?
I don't like it.  How can I get the old behavior back?

TIA,
  vin

-- 
In a minute there is time
For decisions and revisions which a minute will reverse.         T.S. Eliot


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

end of thread, other threads:[~1999-07-15  8:51 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-07-15  8:51 Extra List in 3.1.6-test1 Sven Wischnowsky
  -- strict thread matches above, loose matches on Subject: below --
1999-07-14 16:08 Vin Shelton
1999-07-15  2:34 ` Vin Shelton

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