Re: 0.99.7 Entry (editable?) bug




Tony Gale <gale@daedalus.dera.gov.uk> writes:

> This seems to come down to the function gtk_move_backward_character,
> which calls move_backward_character (both are in gtkentry.c).
> 
> It looks a very complicated way of moving backwards one character to
> me. It appears to recompute where it should be by looping from the
> start of the text, upto it's current position, rather than just from
> it's current position.

The reason for this is that the entry widget (which is fully
internationalized including for the China-Japan-Korea locales
which need 16-bit character sets) uses multi-byte strings
to store the text.

There is no general way (without knowing the details of the
encoding) to determine if a given byte is the first byte
of a multibyte character, or an internal byte, the only really
safe way is to start from the beginning of the string. Which
shouldn't be slow unless your entry has thousands of characters.

In future versions of GTK, I'm interested in making GTK use
Unicode internally for all operations, which will make these
kinds of algorithms easier. 

But there is something screwy going on with the Entry widget...
I'll try to track it down.

Regards,
                                        Owen





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