After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 315065 - at-spi insert event should count characters, not byte
at-spi insert event should count characters, not byte
Status: RESOLVED FIXED
Product: atk
Classification: Platform
Component: gail
unspecified
Other All
: Normal normal
: ---
Assigned To: bill.haneman
bill.haneman
Depends on:
Blocks:
 
 
Reported: 2005-09-01 20:28 UTC by Samuel Thibault
Modified: 2006-11-07 18:02 UTC
See Also:
GNOME target: ---
GNOME version: 2.9/2.10


Attachments
Fixes length field of text insertion events (1.13 KB, patch)
2006-03-20 15:45 UTC, Samuel Thibault
committed Details | Review

Description Samuel Thibault 2005-09-01 20:28:05 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:
Comment 1 bill.haneman 2006-03-20 14:52:57 UTC
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.
Comment 2 Samuel Thibault 2006-03-20 15:45:12 UTC
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.
Comment 3 Samuel Thibault 2006-03-20 15:45:58 UTC
Created attachment 61629 [details] [review]
Fixes length field of text insertion events
Comment 4 bill.haneman 2006-03-20 15:52:33 UTC
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.
Comment 5 Samuel Thibault 2006-03-24 23:55:29 UTC
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?
Comment 6 Calum Benson 2006-04-26 17:05:41 UTC
Apologies for spam... ensuring Sun a11y folks are cc'ed on all current accessibility bugs.
Comment 7 bill.haneman 2006-11-07 18:02:40 UTC
Thanks Samuel!