summaryrefslogtreecommitdiff
path: root/gtk/gtkimcontextwayland.c
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2021-02-17 22:57:41 -0500
committerMatthias Clasen <mclasen@redhat.com>2021-02-17 22:57:41 -0500
commitda71a379457ede018308ad0ce7605d90586a9f3b (patch)
tree867ba7eeae6847d2b4948f9a164168b691076f4c /gtk/gtkimcontextwayland.c
parent05fe2441a7e93f3d1ebf25bfe8e6c945925da0c9 (diff)
downloadgtk+-da71a379457ede018308ad0ce7605d90586a9f3b.tar.gz
imwayland: Return limited preedit attributes
It should not matter, but it is the right thing to do to limit the preedit attributes to the length of the preedit text.
Diffstat (limited to 'gtk/gtkimcontextwayland.c')
-rw-r--r--gtk/gtkimcontextwayland.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/gtk/gtkimcontextwayland.c b/gtk/gtkimcontextwayland.c
index c5e0093584..915ad9e854 100644
--- a/gtk/gtkimcontextwayland.c
+++ b/gtk/gtkimcontextwayland.c
@@ -606,13 +606,23 @@ gtk_im_context_wayland_get_preedit_string (GtkIMContext *context,
if (attrs)
{
+ PangoAttribute *attr;
+ guint len = strlen (preedit_str);
+
if (!*attrs)
*attrs = pango_attr_list_new ();
- pango_attr_list_insert (*attrs,
- pango_attr_underline_new (PANGO_UNDERLINE_SINGLE));
+
+ attr = pango_attr_underline_new (PANGO_UNDERLINE_SINGLE);
+ attr->start_index = 0;
+ attr->end_index = len;
+ pango_attr_list_insert (*attrs, attr);
+
/* enable fallback, since IBus will send us things like ⎄ */
- pango_attr_list_insert (*attrs,
- pango_attr_fallback_new (TRUE));
+ attr = pango_attr_fallback_new (TRUE);
+ attr->start_index = 0;
+ attr->end_index = len;
+ pango_attr_list_insert (*attrs, attr);
+
if (context_wayland->current_preedit.cursor_begin
!= context_wayland->current_preedit.cursor_end)
{