On Tue, Jan 27, 2009 at 09:26:31AM +0100, Carsten Hey wrote: > Hi Martijn. > > I did a *quick* look into the code before I read your mail again and my > first guess was that the line "readline_x = col + strlen( > locale_prompt);" in pal_rl_get_raw_line() counts the length wrong and > thus indirectly causes this bug, but I might be wrong.
Probably. Really, everything dealing with the output width should be calling something like pal_output_wordlen() in output.c. > When fixing this bug we should consider that one UTF-8 characters might > need two columns to be displayed properly, e.g. some Chinese signs. > wcwidth(3) and wcswidth(3) look good under this aspect to determine the > display width of one wide character or one wide-character string. I don't think we need to go that far, glib has g_unichar_iswide() and g_unichar_iszerowidth(). I think using that we can easily make a fuction that does what we want. http://library.gnome.org/devel/glib/unstable/glib-Unicode-Manipulation.html > Grepping for strlen in pal's source code and rethinking what we want to > archive (to get the number of columns needed to display a character, the > number of bytes, the number of characters ...) might point us to some > unreported bugs. I looked at this in the output routines once and I think they're not too far off, only pal_output_wrap() and the readline stuff needs work, I think everything else should be ok. Have a nice day, -- Martijn van Oosterhout <klep...@svana.org> http://svana.org/kleptog/ > Please line up in a tree and maintain the heap invariant while > boarding. Thank you for flying nlogn airlines.
signature.asc
Description: Digital signature