[gtksourceview/wip/search] search: scan also all the buffer if the text is NULL
- From: Sébastien Wilmet <swilmet src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtksourceview/wip/search] search: scan also all the buffer if the text is NULL
- Date: Thu, 20 Jun 2013 20:25:19 +0000 (UTC)
commit f3b0d216727ae88ecda384d3c567d1678bad9f92
Author: Sébastien Wilmet <swilmet gnome org>
Date: Thu Jun 20 22:18:21 2013 +0200
search: scan also all the buffer if the text is NULL
To remove the found_tag. The found_tag was already removed, but only if
the region becomes visible on screen. So when we scrolled, we could see
the search matches disappearing. Now the found_tag is removed in an
idle, chunks by chunks (to not block the UI).
gtksourceview/gtksourcesearch.c | 27 +++++++--------------------
1 files changed, 7 insertions(+), 20 deletions(-)
---
diff --git a/gtksourceview/gtksourcesearch.c b/gtksourceview/gtksourcesearch.c
index 3990929..19bcd4a 100644
--- a/gtksourceview/gtksourcesearch.c
+++ b/gtksourceview/gtksourcesearch.c
@@ -473,15 +473,9 @@ update (GtkSourceSearch *search)
clear_search (search);
- gtk_text_buffer_get_bounds (search->priv->buffer, &start, &end);
-
- if (search->priv->text == NULL)
- {
- g_signal_emit_by_name (search->priv->buffer, "highlight-updated", &start, &end);
- return;
- }
-
search->priv->region = gtk_text_region_new (search->priv->buffer);
+
+ gtk_text_buffer_get_bounds (search->priv->buffer, &start, &end);
add_subregion_to_scan (search, &start, &end);
}
@@ -682,22 +676,15 @@ _gtk_source_search_update_highlight (GtkSourceSearch *search,
g_return_if_fail (start != NULL);
g_return_if_fail (end != NULL);
- if (dispose_has_run (search))
+ if (dispose_has_run (search) ||
+ is_text_region_empty (search->priv->region))
{
return;
}
- if (is_text_region_empty (search->priv->region))
- {
- region_to_highlight = gtk_text_region_new (search->priv->buffer);
- gtk_text_region_add (region_to_highlight, start, end);
- }
- else
- {
- region_to_highlight = gtk_text_region_intersect (search->priv->region,
- start,
- end);
- }
+ region_to_highlight = gtk_text_region_intersect (search->priv->region,
+ start,
+ end);
if (region_to_highlight == NULL)
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]