diff options
Diffstat (limited to 'src/fe-gtk/sexy-spell-entry.c')
-rw-r--r-- | src/fe-gtk/sexy-spell-entry.c | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/src/fe-gtk/sexy-spell-entry.c b/src/fe-gtk/sexy-spell-entry.c index 119acca4..bac1e2b5 100644 --- a/src/fe-gtk/sexy-spell-entry.c +++ b/src/fe-gtk/sexy-spell-entry.c @@ -1112,34 +1112,37 @@ entry_strsplit_utf8(GtkEntry *entry, gchar ***set, gint **starts, gint **ends) const PangoLogAttr *log_attrs; const gchar *text; gint n_attrs, n_strings, i, j; + PangoLogAttr a; layout = gtk_entry_get_layout(GTK_ENTRY(entry)); text = gtk_entry_get_text(GTK_ENTRY(entry)); log_attrs = pango_layout_get_log_attrs_readonly (layout, &n_attrs); /* Find how many words we have */ - n_strings = 0; - for (i = 0; i < n_attrs; i++) - if (log_attrs[i].is_word_start) + for (i = 0, n_strings = 0; i < n_attrs; i++) + { + a = log_attrs[i]; + if (a.is_word_start && a.is_word_boundary) n_strings++; + } *set = g_new0(gchar *, n_strings + 1); *starts = g_new0(gint, n_strings); *ends = g_new0(gint, n_strings); /* Copy out strings */ - for (i = 0, j = 0; i < n_attrs; i++) { - if (log_attrs[i].is_word_start) { + for (i = 0, j = 0; i < n_attrs; i++) + { + a = log_attrs[i]; + if (a.is_word_start && a.is_word_boundary) + { gint cend, bytes; gchar *start; /* Find the end of this string */ for (cend = i; cend < n_attrs; cend++) { - PangoLogAttr a = log_attrs[cend]; - - if (a.is_white) - break; + a = log_attrs[cend]; if (a.is_word_end && a.is_word_boundary) break; } |