summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorxdavidwu <xdavidwuph@gmail.com>2019-12-15 19:19:54 +0800
committerxdavidwu <xdavidwuph@gmail.com>2019-12-15 19:19:54 +0800
commit5ad1316b1ee11686bda63b224eacda33a2ef3e45 (patch)
tree35d861c130df608b3f88912005a1ce47a58d9fa1 /modules
parent725892b65362956ef40752dc446cd3dab248a444 (diff)
downloadgtk+-5ad1316b1ee11686bda63b224eacda33a2ef3e45.tar.gz
imwayland: Fix get_preedit_string cursor position
GtkIMContext get_preedit_string should return cursor position counted in characters, but cursor_begin here is counted in bytes. This add the missing conversion.
Diffstat (limited to 'modules')
-rw-r--r--modules/input/imwayland.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/modules/input/imwayland.c b/modules/input/imwayland.c
index 1c742713b4..7ebeb7d243 100644
--- a/modules/input/imwayland.c
+++ b/modules/input/imwayland.c
@@ -582,7 +582,8 @@ gtk_im_context_wayland_get_preedit_string (GtkIMContext *context,
if (str)
*str = g_strdup (preedit_str);
if (cursor_pos)
- *cursor_pos = context_wayland->current_preedit.cursor_begin;
+ *cursor_pos = g_utf8_strlen (preedit_str,
+ context_wayland->current_preedit.cursor_begin);
if (attrs)
{