Fix apostrophe related spell check issues

This commit is contained in:
RichardHitt 2014-07-21 15:10:21 -04:00 committed by TingPing
parent 0d3706e2ee
commit 7a7b9c682d
1 changed files with 12 additions and 9 deletions

View File

@ -1112,34 +1112,37 @@ entry_strsplit_utf8(GtkEntry *entry, gchar ***set, gint **starts, gint **ends)
const PangoLogAttr *log_attrs; const PangoLogAttr *log_attrs;
const gchar *text; const gchar *text;
gint n_attrs, n_strings, i, j; gint n_attrs, n_strings, i, j;
PangoLogAttr a;
layout = gtk_entry_get_layout(GTK_ENTRY(entry)); layout = gtk_entry_get_layout(GTK_ENTRY(entry));
text = gtk_entry_get_text(GTK_ENTRY(entry)); text = gtk_entry_get_text(GTK_ENTRY(entry));
log_attrs = pango_layout_get_log_attrs_readonly (layout, &n_attrs); log_attrs = pango_layout_get_log_attrs_readonly (layout, &n_attrs);
/* Find how many words we have */ /* Find how many words we have */
n_strings = 0; for (i = 0, n_strings = 0; i < n_attrs; i++)
for (i = 0; i < n_attrs; i++) {
if (log_attrs[i].is_word_start) a = log_attrs[i];
if (a.is_word_start && a.is_word_boundary)
n_strings++; n_strings++;
}
*set = g_new0(gchar *, n_strings + 1); *set = g_new0(gchar *, n_strings + 1);
*starts = g_new0(gint, n_strings); *starts = g_new0(gint, n_strings);
*ends = g_new0(gint, n_strings); *ends = g_new0(gint, n_strings);
/* Copy out strings */ /* Copy out strings */
for (i = 0, j = 0; i < n_attrs; i++) { for (i = 0, j = 0; i < n_attrs; i++)
if (log_attrs[i].is_word_start) { {
a = log_attrs[i];
if (a.is_word_start && a.is_word_boundary)
{
gint cend, bytes; gint cend, bytes;
gchar *start; gchar *start;
/* Find the end of this string */ /* Find the end of this string */
for (cend = i; cend < n_attrs; cend++) for (cend = i; cend < n_attrs; cend++)
{ {
PangoLogAttr a = log_attrs[cend]; a = log_attrs[cend];
if (a.is_white)
break;
if (a.is_word_end && a.is_word_boundary) if (a.is_word_end && a.is_word_boundary)
break; break;
} }