gtk_im_context_simple_get_preedit_string() returns wrong value
I'm one of the developers of SWT window library, here's a link to a bug there: https://bugs.eclipse.org/bugs/show_bug.cgi?id=571740
Steps to reproduce
- Install Spanish keyboard layout
- Press ' key according to US keyboard (2nd after L)
- Observe that
gtk_im_context_simple_get_preedit_string()
returnscursor_pos=2
, that is in bytes instead of characters.
I tried to make a snippet, but it proved to be too hard for me properly create and bind a context.
Current behavior
Contrary to documentation, function returns position in bytes instead of characters.
The problem is obvious in the code of gtk_im_context_simple_get_preedit_string()
where it incorrectly returns s->len
.
Expected outcome
Should return characters. IBus IM handles the same case correctly. Note that this bug is specifically about "simple im".
Version information
It seems that the bug has been there for ages, However, since GTK 3.24.26 the scenario, which seems to be a very common one for Spanish users, now sends preedit-changed
signal which it didn't before. This signal causes our library to call gtk_im_context_get_preedit_string()
and step onto the bug.