From 15483ac9df346b4ff59bb5286ba2598b729b88f1 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Wed, 21 Apr 2021 06:27:26 -0400 Subject: [PATCH] imcontext: Fix cursor positions gtk_im_context_get_preedit_string is documented to return the cursor position as a character offset, not a byte count. So return that. Fixed: #3885 --- gtk/gtkimcontextsimple.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gtk/gtkimcontextsimple.c b/gtk/gtkimcontextsimple.c index a3a2c54c8f..074ffdd01f 100644 --- a/gtk/gtkimcontextsimple.c +++ b/gtk/gtkimcontextsimple.c @@ -1152,7 +1152,7 @@ gtk_im_context_simple_get_preedit_string (GtkIMContext *context, } if (cursor_pos) - *cursor_pos = s->len; + *cursor_pos = g_utf8_strlen (s->str, s->len); if (attrs) {