Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Bug somewhere in verbose output for completion listing



On Thu, 03 Oct 2013 08:09:56 -0700
Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> 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



Messages sorted by: Reverse Date, Date, Thread, Author