Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Bug report: complist miscalculates width of display strings containing a slash (/)
- X-seq: zsh-workers 48391
- From: "Jun. T" <takimoto-j@xxxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Cc: Marlon Richert <marlon.richert@xxxxxxxxx>
- Subject: Re: Bug report: complist miscalculates width of display strings containing a slash (/)
- Date: Mon, 5 Apr 2021 01:08:14 +0900
- Archived-at: <https://zsh.org/zsh-workers/48391>
- Archived-at: <http://www.zsh.org/sympa/arcsearch_id/zsh-workers/2021-04/7CD89E1D-3B11-42B1-A794-F09E5A32F16C%40kba.biglobe.ne.jp>
- In-reply-to: <CAHLkEDtbnFmKiFZ4rgXLvZfo3Fux7yUWbMhF8k5jHKA=j47dMw@mail.gmail.com>
- List-id: <zsh-workers.zsh.org>
- References: <CAHLkEDtbnFmKiFZ4rgXLvZfo3Fux7yUWbMhF8k5jHKA=j47dMw@mail.gmail.com>
> 2021/03/27 7:49, Marlon Richert <marlon.richert@xxxxxxxxx> wrote:
>
> The following test causes the command line to jump and the completion
> menu to visually break ...
Thank you for reporting, and sorry for not responding quickly.
It seems the problem occurs if both '-d disp' and '-f' are given to
compadd, and menu-select is called.
# It becomes more serious if width of the list of completions
# is equal (or close?) to the screen width due to the wrapping.
The following patch add an extra width 1 for the trailing file-type
indicator (/ for directory, etc.) when '-d disp' is given, just as for
the case without '-d disp' (line 2351, 15 lines below the patched line).
diff --git a/Src/Zle/compresult.c b/Src/Zle/compresult.c
index 30fc60b78..8b5955819 100644
--- a/Src/Zle/compresult.c
+++ b/Src/Zle/compresult.c
@@ -1583,7 +1583,7 @@ calclist(int showall)
nlines += 1 + printfmt(m->disp, 0, 0, 0);
g->flags |= CGF_HASDL;
} else {
- l = ZMB_nicewidth(m->disp);
+ l = ZMB_nicewidth(m->disp) + !!m->modec;
ndisp++;
if (l > glong)
glong = l;
Messages sorted by:
Reverse Date,
Date,
Thread,
Author