aboutsummaryrefslogtreecommitdiffstats
path: root/widgets
diff options
context:
space:
mode:
authorChris Toshok <toshok@ximian.com>2004-04-02 15:17:36 +0800
committerChris Toshok <toshok@src.gnome.org>2004-04-02 15:17:36 +0800
commit70895bfdfda0460fbb1c78e6c060db9ea1ce0d04 (patch)
treea440011c442a255ef0ee25d343e2aa8fa4245b39 /widgets
parent4af35d8e59dc383c2b5fa21a2c6dad74b3a6c2dc (diff)
downloadgsoc2013-evolution-70895bfdfda0460fbb1c78e6c060db9ea1ce0d04.tar
gsoc2013-evolution-70895bfdfda0460fbb1c78e6c060db9ea1ce0d04.tar.gz
gsoc2013-evolution-70895bfdfda0460fbb1c78e6c060db9ea1ce0d04.tar.bz2
gsoc2013-evolution-70895bfdfda0460fbb1c78e6c060db9ea1ce0d04.tar.lz
gsoc2013-evolution-70895bfdfda0460fbb1c78e6c060db9ea1ce0d04.tar.xz
gsoc2013-evolution-70895bfdfda0460fbb1c78e6c060db9ea1ce0d04.tar.zst
gsoc2013-evolution-70895bfdfda0460fbb1c78e6c060db9ea1ce0d04.zip
[ fixes bug #51897 ]
2004-04-01 Chris Toshok <toshok@ximian.com> [ fixes bug #51897 ] * gal/e-text/e-text.c (insert_preedit_text): only reset the layout attrs if there is some preedit text to insert. also, try getting text->layout's attributes before creating a new list. this will keep us from overwriting existing attributes and wiping out the underlining for objects. svn path=/trunk/; revision=25294
Diffstat (limited to 'widgets')
-rw-r--r--widgets/text/e-text.c30
1 files changed, 19 insertions, 11 deletions
diff --git a/widgets/text/e-text.c b/widgets/text/e-text.c
index 93fd9d0120..b9aeadf6bf 100644
--- a/widgets/text/e-text.c
+++ b/widgets/text/e-text.c
@@ -293,6 +293,7 @@ insert_preedit_text (EText *text)
gchar *preedit_string = NULL;
GString *tmp_string = g_string_new (NULL);
gint length = 0, cpos = 0, preedit_length = 0;
+ gboolean new_attrs = FALSE;
if (text->layout == NULL || !GTK_IS_IM_CONTEXT (text->im_context))
return;
@@ -302,11 +303,9 @@ insert_preedit_text (EText *text)
g_string_prepend_len (tmp_string, text->text,length);
- attrs = pango_attr_list_new ();
-
gtk_im_context_get_preedit_string (text->im_context,
- &preedit_string, &preedit_attrs,
- NULL);
+ &preedit_string, &preedit_attrs,
+ NULL);
if (preedit_string && g_utf8_validate (preedit_string, -1, NULL))
text->preedit_len = preedit_length = strlen (preedit_string);
@@ -315,15 +314,26 @@ insert_preedit_text (EText *text)
cpos = g_utf8_offset_to_pointer (text->text, text->selection_start) - text->text;
- if (preedit_length)
+ if (preedit_length) {
g_string_insert (tmp_string, cpos, preedit_string);
- reset_layout_attrs (text);
+ reset_layout_attrs (text);
+
+ attrs = pango_layout_get_attributes (text->layout);
+ if (!attrs) {
+ attrs = pango_attr_list_new ();
+ new_attrs = TRUE;
+ }
+
+ pango_layout_set_text (text->layout, tmp_string->str, tmp_string->len);
- pango_layout_set_text (text->layout, tmp_string->str, tmp_string->len);
- if (preedit_length)
pango_attr_list_splice (attrs, preedit_attrs, cpos, preedit_length);
- pango_layout_set_attributes (text->layout, attrs);
+
+ if (new_attrs) {
+ pango_layout_set_attributes (text->layout, attrs);
+ pango_attr_list_unref (attrs);
+ }
+ }
if (preedit_string)
g_free (preedit_string);
@@ -331,8 +341,6 @@ insert_preedit_text (EText *text)
pango_attr_list_unref (preedit_attrs);
if (tmp_string)
g_string_free (tmp_string, TRUE);
- if (attrs)
- pango_attr_list_unref (attrs);
}
static void