Use byte offset for cursor_end/anchor value sent in preedit_string.
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3845>
(cherry picked from commit f214eb5134
)
This commit is contained in:
parent
8978f74c1e
commit
7f344053f8
1 changed files with 7 additions and 7 deletions
|
@ -298,21 +298,21 @@ meta_wayland_text_input_focus_set_preedit_text (ClutterInputFocus *focus,
|
|||
unsigned int anchor)
|
||||
{
|
||||
MetaWaylandTextInput *text_input;
|
||||
gsize pos = 0;
|
||||
gsize cursor_pos = 0, anchor_pos = 0;
|
||||
|
||||
text_input = META_WAYLAND_TEXT_INPUT_FOCUS (focus)->text_input;
|
||||
|
||||
if (text)
|
||||
pos = g_utf8_offset_to_pointer (text, cursor) - text;
|
||||
|
||||
g_clear_pointer (&text_input->preedit.string, g_free);
|
||||
text_input->preedit.string = g_strdup (text);
|
||||
|
||||
if (text)
|
||||
pos = g_utf8_offset_to_pointer (text, cursor) - text;
|
||||
{
|
||||
cursor_pos = g_utf8_offset_to_pointer (text, cursor) - text;
|
||||
anchor_pos = g_utf8_offset_to_pointer (text, anchor) - text;
|
||||
}
|
||||
|
||||
text_input->preedit.cursor = pos;
|
||||
text_input->preedit.anchor = anchor;
|
||||
text_input->preedit.cursor = cursor_pos;
|
||||
text_input->preedit.anchor = anchor_pos;
|
||||
text_input->preedit.changed = TRUE;
|
||||
|
||||
meta_wayland_text_input_focus_defer_done (focus);
|
||||
|
|
Loading…
Reference in a new issue