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

Re: Bug somewhere in verbose output for completion listing



On Oct 3,  8:09am, Bart Schaefer wrote:
}
} 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".

OK, right track, wrong details.  (There is no cdstate.minmlen)  The
problem is with cd_state.premaxw, which is the padding width.  This
gets set in cd_calc() but is never changed unless it gets larger.

The following superfically fixes it, but I haven't checked in detail
what happens in cases where the same list is being re-used (e.g. by
_oldlist) for successive completions.

I also haven't checked the case of multiple completions in different
groups (the case from the old thread I linked earlier), or whether the
LIST_PACKED option has any effect either way.

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;



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