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

Re: Phil's prompt is not working when LANG is set to UTF-8



On Friday 15 February 2008, Andrey Borzenkov wrote:
> On Thursday 14 February 2008, Peter Stephenson wrote:
> > 
> > Wael Nasreddine wrote:
> > > Peter I couldn't install Fedora because it doesn't work with LVM over
> > > DM-Crypt, have you tried my environment ??
> > 
> > No, it seems unlikely I'm going to have time for that sort of
> > time-consuming procedure which is any case speculative.  It seems like
> > the next step is understanding the implications of Andrei's findings
> > since he's already narrowed it down.  I don't currently know anything
> > about the system he's talking about.
> > 
> 
> 
> I took liberty to move this to workers.
> 
> In case it rings the bell for anyone. Here are prompt lengths computed by
> zsh for phil's prompt in ru_RU.UTF-8 locale (where there were the same
> results for en_US.UTF-8 as well, so at least proper UTF-8 part is correctly
> computed :) )
> 
> (gdb) p rpromptw
> $1 = 12
> (gdb) p lpromptw
> $2 = 9
> (gdb) p lprompth
> $3 = 2
> (gdb) p rprompth
> $4 = 1
> 
> that's absolutely wrong. The actual prompt lengths are (see screenshot)
> 
> lpromptw = 13
> rptomptw = 16 (it has one space in it)
> 
> this perfectly correspnds to something (zsh?) ignoring invalid characters
> with high bit set.

For sure.

Src/prompt.c:countprompt()

            case MB_INVALID:
                memset(&mbs, 0, sizeof mbs);
                /* FALL THROUGH */
            case 0:
                /* Invalid character or null: assume no output. */
                multi = 0;
                break;

Oops.

I do not actually see how can we fix it except introducing prompt
expansion syntax for ACS (or may be for any terminfo sequence in general)
and simply assuming characters in any of them are of width 1.

> In both left and right prompts there are exactly 4 of 
> ACS chars.
> 
> I attach both left and ritgh prompts as well.
> 


Attachment: signature.asc
Description: This is a digitally signed message part.



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