GNOME Bugzilla – Bug 315065
at-spi insert event should count characters, not byte
Last modified: 2006-11-07 18:02:40 UTC
Please describe the problem: Hi, There is a little accessible problem with editable text widget: when typing a character that uses several bytes when coded in utf-8, the associated AtSpi object:text-changed:insert event holds the number of bytes as character count (detail2 of the event). This should really a character count, not the number of bytes that the characters take. object:text-changed:delete works fine however. Steps to reproduce: 1. Run a gtk application with editable text 2. Run an at-spi event listener, make it listen to object:text-changed events 3. type 'é' Actual results: The event corresponding to typing 'é' holds 2 in the detail2 field. Expected results: The detail2 field should be 1 (only one character was typed). Does this happen every time? Yes. Other information:
If this is true, it's a gail issue, not ATK, since ATK specifies that the event should contain the 'length' of the insertion/deletion. The docs should be improved to make this more explicit, as well.
Yes, it still happens. And indeed it seems to come from gail: the _gail_entry_insert_text_cb() callback is given the size of the inserted string in bytes, not in characters (as documentation for gtk_editable_insert_text says). While the _gail_entry_delete_text_cb() callback is given character positions. The following patch seems to work.
Created attachment 61629 [details] [review] Fixes length field of text insertion events
Comment on attachment 61629 [details] [review] Fixes length field of text insertion events Thanks Samuel! Please commit, if you can preface with g_utf8_validate calls.
Mmm, just to make sure (I'm not sure whom you were talking to): I don't have any commit access. About g_utf8_validate, I don't see what sane thing could be done if the given string is not utf-8. Isn't it validated before the callback is called anyway?
Apologies for spam... ensuring Sun a11y folks are cc'ed on all current accessibility bugs.
Thanks Samuel!