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

Re: weird behaviour

09.05.2016, 21:40, "david sowerby" <d_sowerby@xxxxxxxxx>:
> I noticed recently that when I <tab> to complete zsh doubles the first letter of the command eg:
> % cd T <tab> expands to TV - as expected and the expansion works as normal - unless there are more than one choice when it does this
> % ccd /TV/TV/ARROW/ with the multiple dirs shown below as expected
> This doesn't affect the command at all, and if I backspace I can't remove the first 'c', and if I then hit <enter> nothing happens ie as if the command 'c' isn't there.
> I'm using 5.0.7 (Debian 8) in urvxt. I also tested in xterm and get the same result, strangely it doesn't happen on a console. I tried zsh -l in urxvt and get the same double letter result, but in xterm it is fine! Running a bare "compinit" without any extras doesn't make any difference. Has anyone else noticed this? I'm baffled :-/
> ------------------------------dave
> ====================================================
> Morality is doing what is right, no matter what you are told.
> Religion is doing what you are told, no matter what is right.
>                                                               H.L. Mencken

You clearly have some problem with prompt. Most likely you forgot to surround something in PS1 with %{ … %} and zsh was no longer able to determine real prompt width. When you do completion in some cases zsh needs to redraw command text in which case it basically does “go to position {just after the place where PS1 ends} and print ‘cd …’”. If position is wrong you see what you see, but zsh still knows that it needs to run “cd …” and not “ccd …”.

Except for missing %{ … %} there is another possible reason for this: zsh thinks that some character is double width, but terminal emulator thinks it has single width. If this is the case I do not know how to fix this cleanely (it is always possible to construct some hack).

In any case you need to check your PS1.

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