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

Re: Bug report: complist miscalculates width of display strings containing a slash (/)



> 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