zsh-workers
 help / color / mirror / code / Atom feed
From: Sven Wischnowsky <wischnow@informatik.hu-berlin.de>
To: zsh-workers@sunsite.auc.dk
Subject: PATCH: completion listing (was: zsh hangup with listpacked and Problem with zle completion listing function)
Date: Mon, 8 Jan 2001 16:22:52 +0100 (MET)	[thread overview]
Message-ID: <200101081522.QAA10124@beta.informatik.hu-berlin.de> (raw)
In-Reply-To: Peter Stephenson's message of Thu, 04 Jan 2001 12:13:12 +0000


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


             reply	other threads:[~2001-01-08 15:23 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-01-08 15:22 Sven Wischnowsky [this message]
2001-01-08 16:49 ` Peter Stephenson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200101081522.QAA10124@beta.informatik.hu-berlin.de \
    --to=wischnow@informatik.hu-berlin.de \
    --cc=zsh-workers@sunsite.auc.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).