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

Re: Strange behaviour in completion when prompt is colorized



2008/5/4 Gowtham M <gowthamgowtham@xxxxxxxxx>:
> Hi, While completing commands/filenames. zsh is inserting some spaces on
> the command-line. However, it lists down the possible matches also... How
> can
> I make it not insert these annoying spaces?
>
> For example, if I type pdf at the prompt and hit TAB,
>  ~> pdf<TAB>
>
> The result is:
>
> ~> pdf              _<-- The cursor is now here!
> pdf2dsc      pdfetex      pdfinfo      pdfopt       pdftops
> pdf2ps       pdfevirtex   pdfinitex    pdfs@        pdftotext
>  pdfeinitex   pdffonts     pdfjadetex   pdftex       pdfvirtex
> pdfelatex    pdfimages    pdflatex     pdftopbm     pdfxmltex
>
>
> This is happening only if I add colors to my prompt.
> PS1="$fg[default]$fg[red]%c$fg[default]> "
>
> I was using zsh 4.0.7 but this is same with zsh 4.3.6
>
> Thanks
> Gowtham

The problem is probably that you didn't wrap the color code sequences
in %{ and %} prompt escapes, which makes zsh think the prompt is wider
than it actually is, since the color escapes don't take up any space.

-- 
Mikael Magnusson



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