zsh-workers
 help / color / mirror / code / Atom feed
From: Peter Stephenson <p.stephenson@samsung.com>
To: Zsh Hackers' List <zsh-workers@zsh.org>
Subject: Re: Bug somewhere in verbose output for completion listing
Date: Thu, 03 Oct 2013 17:20:07 +0100	[thread overview]
Message-ID: <20131003172007.57e1e825@pwslap01u.europe.root.pri> (raw)
In-Reply-To: <131003080956.ZM1033@torch.brasslantern.com>

On Thu, 03 Oct 2013 08:09:56 -0700
Bart Schaefer <schaefer@brasslantern.com> wrote:

> On Oct 3,  7:50am, Bart Schaefer wrote:
> }
> }     http://www.zsh.org/mla/workers/2013/msg00368.html
> } 
> } Unfortunately I don't have any new insights.
> 
> Well, one maybe:  There's a static global struct in computil.c called
> cd_state that has maxmlen and minmlen fields.  Those are based on the
> exported globals maxmlen and minmlen from compcore.c, which the comment
> (there's a comment!) describes as "Length of the longest/shortest match".
> 
> A bit of grepping does not find anywhere that cd_state.maxmlen is reset
> across ZLE exit/restart.  I'm a bit worried that forcibly doing so may
> slow down or actually break _oldlist, but maybe cd_state is the place
> to start looking.

Thanks, I think that may have been all the assistance that was needed.
I discovered that before the problem took effect, completing after wtf
gave

(gdb) p cd_state
$1 = {showd = 1, sep = 0xa0f64e8 "# ", slen = 2, swidth = 2, maxmlen = 40, sets = 0xa1183b0, pre = 10, premaxw = 10, suf = 36, maxg = 1, maxglen = 12, groups = 0, descs = 2, gprew = 0, runs = 0x0}

and with the problem showing up it gave

(gdb) p cd_state
$2 = {showd = 1, sep = 0xa0f64e8 "# ", slen = 2, swidth = 2, maxmlen = 40, sets = 0xa1183b0, pre = 10, premaxw = 102, suf = 36, maxg = 1, maxglen = 12, groups = 0, descs = 2, gprew = 0, runs = 0x0}

so premaxw has gone up.  Sure enough it doesn't get reset with most of the
other stuff in cd_init(), and I can't see any reason why it shouldn't
be.  It must start off initially at 0 so resetting it to 0 each time
we initialise the state can't make anything worse (theoretically).

This removes the persistent problem: you still don't get descriptions
with very long completions, even though list-separator is output, which
seems a dodgy combination of things, but that's obviously a different
issue.

diff --git a/Src/Zle/computil.c b/Src/Zle/computil.c
index f8983c3..ee39185 100644
--- a/Src/Zle/computil.c
+++ b/Src/Zle/computil.c
@@ -465,6 +465,7 @@ cd_init(char *nam, char *hide, char *mlen, char *sep,
     cd_state.showd = disp;
     cd_state.maxg = cd_state.groups = cd_state.descs = 0;
     cd_state.maxmlen = atoi(mlen);
+    cd_state.premaxw = 0;
     itmp = zterm_columns - cd_state.swidth - 4;
     if (cd_state.maxmlen > itmp)
         cd_state.maxmlen = itmp;

pws


  parent reply	other threads:[~2013-10-03 16:30 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-03 13:00 Peter Stephenson
2013-10-03 13:32 ` Peter Stephenson
2013-10-03 22:54   ` Bart Schaefer
2013-10-03 14:50 ` Bart Schaefer
2013-10-03 15:09   ` Bart Schaefer
2013-10-03 16:19     ` Bart Schaefer
2013-10-03 16:20     ` Peter Stephenson [this message]
2013-10-03 16:34       ` Peter Stephenson
2013-10-04  4:01       ` Bart Schaefer

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=20131003172007.57e1e825@pwslap01u.europe.root.pri \
    --to=p.stephenson@samsung.com \
    --cc=zsh-workers@zsh.org \
    /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).