[gtksourceview/wip/search-start-signal: 3/5] buffer: split update_syntax/search_highlight()
- From: Sébastien Wilmet <swilmet src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtksourceview/wip/search-start-signal: 3/5] buffer: split update_syntax/search_highlight()
- Date: Wed, 10 Aug 2016 16:46:58 +0000 (UTC)
commit 93bb09e2013775232595bc9b1ce1fa40bb3919fe
Author: Sébastien Wilmet <swilmet gnome org>
Date: Wed Aug 10 15:38:43 2016 +0200
buffer: split update_syntax/search_highlight()
To update only what is necessary.
gtksourceview/gtksourcebuffer-private.h | 10 ++++++++--
gtksourceview/gtksourcebuffer.c | 31 +++++++++++++++++++------------
gtksourceview/gtksourceview.c | 20 +++++++++++---------
3 files changed, 38 insertions(+), 23 deletions(-)
---
diff --git a/gtksourceview/gtksourcebuffer-private.h b/gtksourceview/gtksourcebuffer-private.h
index b329d92..bbc0574 100644
--- a/gtksourceview/gtksourcebuffer-private.h
+++ b/gtksourceview/gtksourcebuffer-private.h
@@ -2,7 +2,7 @@
/* gtksourcebuffer-private.h
* This file is part of GtkSourceView
*
- * Copyright (C) 2013 - Sébastien Wilmet <swilmet gnome org>
+ * Copyright (C) 2013, 2016 - Sébastien Wilmet <swilmet gnome org>
*
* GtkSourceView is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -29,7 +29,13 @@
G_BEGIN_DECLS
GTK_SOURCE_INTERNAL
-void _gtk_source_buffer_update_highlight (GtkSourceBuffer *buffer,
+void _gtk_source_buffer_update_syntax_highlight (GtkSourceBuffer *buffer,
+ const GtkTextIter *start,
+ const GtkTextIter *end,
+ gboolean synchronous);
+
+GTK_SOURCE_INTERNAL
+void _gtk_source_buffer_update_search_highlight (GtkSourceBuffer *buffer,
const GtkTextIter *start,
const GtkTextIter *end,
gboolean synchronous);
diff --git a/gtksourceview/gtksourcebuffer.c b/gtksourceview/gtksourcebuffer.c
index 5063a3b..13260e7 100644
--- a/gtksourceview/gtksourcebuffer.c
+++ b/gtksourceview/gtksourcebuffer.c
@@ -1794,8 +1794,8 @@ gtk_source_buffer_get_language (GtkSourceBuffer *buffer)
return buffer->priv->language;
}
-/**
- * _gtk_source_buffer_update_highlight:
+/*
+ * _gtk_source_buffer_update_syntax_highlight:
* @buffer: a #GtkSourceBuffer.
* @start: start of the area to highlight.
* @end: end of the area to highlight.
@@ -1804,13 +1804,11 @@ gtk_source_buffer_get_language (GtkSourceBuffer *buffer)
* Asks the buffer to analyze and highlight given area.
*/
void
-_gtk_source_buffer_update_highlight (GtkSourceBuffer *buffer,
- const GtkTextIter *start,
- const GtkTextIter *end,
- gboolean synchronous)
+_gtk_source_buffer_update_syntax_highlight (GtkSourceBuffer *buffer,
+ const GtkTextIter *start,
+ const GtkTextIter *end,
+ gboolean synchronous)
{
- GList *l;
-
g_return_if_fail (GTK_SOURCE_IS_BUFFER (buffer));
if (buffer->priv->highlight_engine != NULL)
@@ -1820,6 +1818,17 @@ _gtk_source_buffer_update_highlight (GtkSourceBuffer *buffer,
end,
synchronous);
}
+}
+
+void
+_gtk_source_buffer_update_search_highlight (GtkSourceBuffer *buffer,
+ const GtkTextIter *start,
+ const GtkTextIter *end,
+ gboolean synchronous)
+{
+ GList *l;
+
+ g_return_if_fail (GTK_SOURCE_IS_BUFFER (buffer));
for (l = buffer->priv->search_contexts; l != NULL; l = l->next)
{
@@ -1853,10 +1862,8 @@ gtk_source_buffer_ensure_highlight (GtkSourceBuffer *buffer,
const GtkTextIter *start,
const GtkTextIter *end)
{
- _gtk_source_buffer_update_highlight (buffer,
- start,
- end,
- TRUE);
+ _gtk_source_buffer_update_syntax_highlight (buffer, start, end, TRUE);
+ _gtk_source_buffer_update_search_highlight (buffer, start, end, TRUE);
}
/**
diff --git a/gtksourceview/gtksourceview.c b/gtksourceview/gtksourceview.c
index 51e0547..4a0200f 100644
--- a/gtksourceview/gtksourceview.c
+++ b/gtksourceview/gtksourceview.c
@@ -1419,16 +1419,16 @@ highlight_updated_cb (GtkSourceBuffer *buffer,
*
* A previous implementation of this signal handler queued a redraw on
* the view with gtk_widget_queue_draw_area(), instead of calling
- * directly _gtk_source_buffer_update_highlight(). The ::draw handler
- * also calls _gtk_source_buffer_update_highlight(), so this had the
- * desired effect, but it was less clear.
+ * directly _gtk_source_buffer_update_syntax_highlight(). The ::draw
+ * handler also calls _gtk_source_buffer_update_syntax_highlight(), so
+ * this had the desired effect, but it was less clear.
* See the Git commit 949cd128064201935f90d999544e6a19f8e3baa6.
* And: https://bugzilla.gnome.org/show_bug.cgi?id=767565
*/
- _gtk_source_buffer_update_highlight (buffer,
- &intersect_start,
- &intersect_end,
- FALSE);
+ _gtk_source_buffer_update_syntax_highlight (buffer,
+ &intersect_start,
+ &intersect_end,
+ FALSE);
}
static void
@@ -2234,8 +2234,10 @@ gtk_source_view_ensure_redrawn_rect_is_highlighted (GtkSourceView *view,
gtk_text_iter_get_line (&iter2));
});
- _gtk_source_buffer_update_highlight (view->priv->source_buffer,
- &iter1, &iter2, FALSE);
+ _gtk_source_buffer_update_syntax_highlight (view->priv->source_buffer,
+ &iter1, &iter2, FALSE);
+ _gtk_source_buffer_update_search_highlight (view->priv->source_buffer,
+ &iter1, &iter2, FALSE);
}
/* This function is taken from gtk+/tests/testtext.c */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]