[gspell/wip/improve-perfs] InlineCheckerTextBuffer: start new check_subregion() implementation
- From: Sébastien Wilmet <swilmet src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gspell/wip/improve-perfs] InlineCheckerTextBuffer: start new check_subregion() implementation
- Date: Sat, 1 Apr 2017 17:40:05 +0000 (UTC)
commit cce36e06dc2d53ccca1bb667c7387c69115ba96f
Author: Sébastien Wilmet <swilmet gnome org>
Date: Sat Apr 1 19:33:01 2017 +0200
InlineCheckerTextBuffer: start new check_subregion() implementation
https://bugzilla.gnome.org/show_bug.cgi?id=776811#c5
gspell/gspell-inline-checker-text-buffer.c | 27 +++++++++++++++++++++++++++
1 files changed, 27 insertions(+), 0 deletions(-)
---
diff --git a/gspell/gspell-inline-checker-text-buffer.c b/gspell/gspell-inline-checker-text-buffer.c
index de317d1..d94d1b9 100644
--- a/gspell/gspell-inline-checker-text-buffer.c
+++ b/gspell/gspell-inline-checker-text-buffer.c
@@ -161,10 +161,30 @@ adjust_iters (GtkTextIter *start,
}
static void
+get_pango_log_attrs (const gchar *text,
+ PangoLogAttr **log_attrs,
+ gint *n_attrs)
+{
+ *n_attrs = g_utf8_strlen (text, -1) + 1;
+ *log_attrs = g_new0 (PangoLogAttr, *n_attrs);
+
+ pango_get_log_attrs (text,
+ strlen (text),
+ -1,
+ NULL,
+ *log_attrs,
+ *n_attrs);
+}
+
+static void
check_subregion (GspellInlineCheckerTextBuffer *spell,
GtkTextIter *start,
GtkTextIter *end)
{
+ gchar *text;
+ PangoLogAttr *log_attrs;
+ gint n_attrs;
+
g_return_if_fail (gtk_text_iter_compare (start, end) <= 0);
adjust_iters (start, end, ADJUST_MODE_STRICTLY_INSIDE_WORD);
@@ -173,6 +193,13 @@ check_subregion (GspellInlineCheckerTextBuffer *spell,
spell->highlight_tag,
start,
end);
+
+ text = gtk_text_iter_get_slice (start, end);
+
+ get_pango_log_attrs (text, &log_attrs, &n_attrs);
+
+ g_free (text);
+ g_free (log_attrs);
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]