zsh-workers
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: "Zsh Hackers' List" <zsh-workers@zsh.org>
Subject: Re: Bug somewhere in verbose output for completion listing
Date: Thu, 03 Oct 2013 09:19:36 -0700	[thread overview]
Message-ID: <131003091936.ZM1364@torch.brasslantern.com> (raw)
In-Reply-To: <131003080956.ZM1033@torch.brasslantern.com>

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;


  reply	other threads:[~2013-10-03 16:19 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 [this message]
2013-10-03 16:20     ` Peter Stephenson
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=131003091936.ZM1364@torch.brasslantern.com \
    --to=schaefer@brasslantern.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).