summaryrefslogtreecommitdiff
path: root/gtk/gtkimcontextwayland.c
diff options
context:
space:
mode:
authorxdavidwu <xdavidwuph@gmail.com>2020-01-17 16:01:01 +0800
committerxdavidwu <xdavidwuph@gmail.com>2020-01-17 16:16:13 +0800
commit9576222b475129d3b178a1fac9b511976c9695b7 (patch)
treee4ae5a218ef752571e3e3d4a75f6c1a43a2fd84c /gtk/gtkimcontextwayland.c
parent7738a05bd26005c5a40a63a9a7ca7934de3d82f9 (diff)
downloadgtk+-9576222b475129d3b178a1fac9b511976c9695b7.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 'gtk/gtkimcontextwayland.c')
-rw-r--r--gtk/gtkimcontextwayland.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/gtk/gtkimcontextwayland.c b/gtk/gtkimcontextwayland.c
index 3344a68cad..4fcc2f9a01 100644
--- a/gtk/gtkimcontextwayland.c
+++ b/gtk/gtkimcontextwayland.c
@@ -592,7 +592,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)
{