]> git.ozlabs.org Git - petitboot/commitdiff
ui/ncurses: Display multibyte strings correctly in textscreens
authorSamuel Mendoza-Jonas <sam@mendozajonas.com>
Tue, 10 Oct 2017 04:36:27 +0000 (15:36 +1100)
committerSamuel Mendoza-Jonas <sam@mendozajonas.com>
Wed, 11 Oct 2017 02:39:16 +0000 (13:39 +1100)
In nc-textscreen each line of text is capped at a certain length to
avoid running off the side of the viewable screen. However it appears
the ncurses function mvwaddnstr() counts by byte instead of actual
character, causing strings which contain multibyte characters to be cut
short.

To avoid this check the displayed length of each string against the
screen width, and if under instruct mvwaddnstr() to print the whole
string.

Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
(cherry picked from commit eac7fc04e7ce07f6b1a6a0d19af86ae7f74ebc5e)


No differences found