zsh-workers
 help / color / mirror / code / Atom feed
* PATCH: completion listing (was: zsh hangup with listpacked and Problem with zle completion listing function)
@ 2001-01-08 15:22 Sven Wischnowsky
  2001-01-08 16:49 ` Peter Stephenson
  0 siblings, 1 reply; 2+ messages in thread
From: Sven Wischnowsky @ 2001-01-08 15:22 UTC (permalink / raw)
  To: zsh-workers


Tanaka Akira wrote:

> I found zsh hangup with listpacked on 80x24 terminal as follows.
> 
> Z(2):akr@flux% zsh -f
> flux% stty size
> 24 80
> flux% echo $ZSH_VERSION 
> 3.1.9-dev-8
> flux% autoload -U compinit; compinit -D; setopt listpacked; compdef _tst tst
> flux% _tst () {
> function> compadd aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
> function> }
> flux% tst <TAB>
> 
> A shorter or longer `a's doesn't cause hangup.

Oops, wrong test in some places (one place, copied multiple times).


Peter Stephenson wrote:

> I have the following function set up as an ordinary zle widget, with zle
> -N, and bound to ^D.  It's supposed to make sure that when I type ^D I
> always get a freshly calculated list, so that I can list the contents of a
> directory which appears with menu completion --- otherwise it will just
> redraw the current menu list.  (Of course, what I *really* want is
> something smarter: if a list is already displayed, assume I want it updated
> based on what's currently on the command line, but I couldn't work out how
> to do that.)

Hm. I don't exactly understand how this would differ from your
version...?

> ...
> 
> It's a hack, but it still doesn't work.  First, I only get the new list the
> second time I type ^D.  More explicitly: suppose I am in the top-level zsh
> directory with menucomplete set, and type `echo Co<TAB>'.  This will show
> `Completion/'; a further TAB would show `Config/'.  Now I type '^D'.  The
> first time, I just get the same list, only the second time do I get the
> contents I want.  I'm sure I should be able to work out what's going on,
> but it's not immediately obvious.

I can't reproduce this. I tried it with and without autolist and with
and without _oldlist in the completer list. Even if the patch below
fixes the main problem I'd like to be able to track this down.

> The real problem is when I type '^D' a third time: the shell then crashes.
> This is obviously a real bug.  Here's the backtrace.  `*minfo.cur' is
> 0xffffffff, which is obviously not a good thing to dereference.

It was trying to access an already freed match, I guess. The patch
makes minfo.cur be reset whenever the matches are freed.


Bye
 Sven

Index: Src/Zle/compcore.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Zle/compcore.c,v
retrieving revision 1.41
diff -u -r1.41 compcore.c
--- Src/Zle/compcore.c	2000/10/11 12:19:25	1.41
+++ Src/Zle/compcore.c	2001/01/08 15:20:28
@@ -2932,4 +2932,5 @@
 
 	g = n;
     }
+    minfo.cur = NULL;
 }
Index: Src/Zle/compresult.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Zle/compresult.c,v
retrieving revision 1.27
diff -u -r1.27 compresult.c
--- Src/Zle/compresult.c	2000/10/25 08:18:45	1.27
+++ Src/Zle/compresult.c	2001/01/08 15:20:29
@@ -1495,7 +1495,7 @@
 				ws[tcol++] = maxlen;
 				width += maxlen;
 			    }
-			    if (!count && width < columns &&
+			    if (!count && width <= columns &&
 				(tcols <= 0 || beg == end))
 				break;
 
@@ -1536,7 +1536,7 @@
 				ws[tcols++] = maxlen;
 				width += maxlen;
 			    }
-			    if (nth == yl && width < columns &&
+			    if (nth == yl && width <= columns &&
 				(beg == end || tlines >= g->lins))
 				break;
 
@@ -1593,7 +1593,7 @@
 			    ws[tcol++] = maxlen;
 			    width += maxlen;
 			}
-			if (!count && width < columns &&
+			if (!count && width <= columns &&
 			    (tcols <= 0 || beg == end))
 			    break;
 
@@ -1642,7 +1642,7 @@
 			    ws[tcols++] = maxlen;
 			    width += maxlen;
 			}
-			if (nth == g->dcount && width < columns &&
+			if (nth == g->dcount && width <= columns &&
 			    (beg == end || tlines >= g->lins))
 			    break;
 

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


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

* Re: PATCH: completion listing (was: zsh hangup with listpacked and Problem with zle completion listing function)
  2001-01-08 15:22 PATCH: completion listing (was: zsh hangup with listpacked and Problem with zle completion listing function) Sven Wischnowsky
@ 2001-01-08 16:49 ` Peter Stephenson
  0 siblings, 0 replies; 2+ messages in thread
From: Peter Stephenson @ 2001-01-08 16:49 UTC (permalink / raw)
  To: Zsh hackers list

Sven wrote:
> Peter Stephenson wrote:
> > I have the following function set up as an ordinary zle widget, with zle
> > -N, and bound to ^D.  It's supposed to make sure that when I type ^D I
> > always get a freshly calculated list, so that I can list the contents of a
> > directory which appears with menu completion --- otherwise it will just
> > redraw the current menu list.  (Of course, what I *really* want is
> > something smarter: if a list is already displayed, assume I want it updated
> > based on what's currently on the command line, but I couldn't work out how
> > to do that.)
> 
> Hm. I don't exactly understand how this would differ from your
> version...?

If a list wasn't displayed, it should do what it currently does, displaying
the relevant list for the active completion.  It's extremely minor --- I
have autolist on, so I get the list willy-nilly.
 
> I can't reproduce this. I tried it with and without autolist and with
> and without _oldlist in the completer list. Even if the patch below
> fixes the main problem I'd like to be able to track this down.

It does fix the problem, thanks.  _oldlist was the reason I needed to hit
^D twice.  Setting the old-list style should fix this, although I haven't
worked out if that's going to make me cross somewhere else.  So at the
moment everything is now working.
 
The completers I had, by the way, were

zstyle ':completion:*' completer _oldlist _expand _complete _approximate

-- 
Peter Stephenson <pws@csr.com>                  Software Engineer
Cambridge Silicon Radio, Unit 300, Science Park, Milton Road,
Cambridge, CB4 0XL, UK                          Tel: +44 (0)1223 392070


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

end of thread, other threads:[~2001-01-08 16:50 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-01-08 15:22 PATCH: completion listing (was: zsh hangup with listpacked and Problem with zle completion listing function) Sven Wischnowsky
2001-01-08 16:49 ` Peter Stephenson

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