[gtksourceview/wip/search] search: do not initialize the found tag too early
- From: Sébastien Wilmet <swilmet src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtksourceview/wip/search] search: do not initialize the found tag too early
- Date: Sat, 22 Jun 2013 10:47:30 +0000 (UTC)
commit e3d622c6b4a9600885547f5964c0fa5cd553e78b
Author: Sébastien Wilmet <swilmet gnome org>
Date: Sat Jun 22 12:42:47 2013 +0200
search: do not initialize the found tag too early
gtksourceview/gtksourcesearch.c | 15 ++++++++-------
1 files changed, 8 insertions(+), 7 deletions(-)
---
diff --git a/gtksourceview/gtksourcesearch.c b/gtksourceview/gtksourcesearch.c
index bdf15bb..210cea6 100644
--- a/gtksourceview/gtksourcesearch.c
+++ b/gtksourceview/gtksourcesearch.c
@@ -168,14 +168,12 @@ sync_found_tag (GtkSourceSearch *search)
_gtk_source_style_apply (style, search->priv->found_tag);
}
+/* Make sure to call this function when the buffer is constructed, else there is
+ * a problem with the tag table already initialized while it shouldn't.
+ */
static void
init_found_tag (GtkSourceSearch *search)
{
- if (search->priv->found_tag != NULL)
- {
- return;
- }
-
search->priv->found_tag = gtk_text_buffer_create_tag (search->priv->buffer, NULL, NULL);
sync_found_tag (search);
@@ -421,6 +419,11 @@ scan_subregion (GtkSourceSearch *search,
GtkTextIter *limit;
gboolean found = TRUE;
+ if (search->priv->found_tag == NULL)
+ {
+ init_found_tag (search);
+ }
+
/* Make sure the 'found' tag has the priority over syntax highlighting
* tags. */
text_tag_set_highest_priority (search->priv->found_tag,
@@ -794,8 +797,6 @@ set_buffer (GtkSourceSearch *search,
G_CALLBACK (delete_range_after_cb),
search,
G_CONNECT_AFTER | G_CONNECT_SWAPPED);
-
- init_found_tag (search);
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]