From 9576222b475129d3b178a1fac9b511976c9695b7 Mon Sep 17 00:00:00 2001 From: xdavidwu Date: Fri, 17 Jan 2020 16:01:01 +0800 Subject: 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. --- gtk/gtkimcontextwayland.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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) { -- cgit v1.2.1