screen-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[screen-devel] compounding trailing whitespace when using utf8 in hardst


From: Dustin Kirkland
Subject: [screen-devel] compounding trailing whitespace when using utf8 in hardstatus/caption
Date: Fri, 14 Jan 2011 13:00:55 -0600

Hi,

I'm quite interested commit 28c161010579e59ae5d310db277f8978911ac794,
which fixes the display of multibyte unicode characters in the caption
and hardstatus lines.

I can confirm that, in fact, that commit does display utf8 characters,
such as "☮" correctly.  Thanks!

However, it does introduce a new bug, though.  It seems that the
padding introduced by %=, though isn't quite handled correctly.

You can easily test it like this:

/tmp/screenrc:
hardstatus alwayslastline
hardstatus string '☮%c%=%c'

Then, building the latest screen from git:
./screen -c /tmp/screenrc

The last line will look like this:
"☮12:56
         12:56  "

Note the two trailing whitespace characters after the final %c (time)
display.  This will scale linearly with the number of utf8 characters
you put in your hardstatus.  That is, if I put 4 x ☮, there will be 8
trailing whitespaces.

It seems to me that there is some accounting missing somewhere, among
the various places that string-length is calculated, which might
involve multi-byte characters.

I've spent a few hours fiddling with the code, as has my colleague on
CC, Kees Cook.  He's come up with the attached patch, but it's not
quite there yet.  Can anyone here give us a few pointers to nudge us
along?

-- 
:-Dustin

Dustin Kirkland
Ubuntu Core Developer

Attachment: adjust-padding-for-utf8.patch
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]