[gtksourceview] Bracket matching: factor out update_bracket_highlighting()



commit eb768743a74ece6597762ab032324ab0f1d77b4b
Author: Sébastien Wilmet <swilmet gnome org>
Date:   Sun Oct 25 12:41:08 2015 +0100

    Bracket matching: factor out update_bracket_highlighting()
    
    cursor_moved() is kept, since it has a more meaningful name. When
    calling cursor_moved(), the intention is clearer: "the cursor has
    moved". The compiler will anyway optimize the code.

 gtksourceview/gtksourcebuffer.c |   13 +++++++++++--
 1 files changed, 11 insertions(+), 2 deletions(-)
---
diff --git a/gtksourceview/gtksourcebuffer.c b/gtksourceview/gtksourcebuffer.c
index 527286a..4250ebc 100644
--- a/gtksourceview/gtksourcebuffer.c
+++ b/gtksourceview/gtksourcebuffer.c
@@ -867,7 +867,7 @@ bracket_pair (gunichar  base_char,
 }
 
 static void
-cursor_moved (GtkSourceBuffer *source_buffer)
+update_bracket_highlighting (GtkSourceBuffer *source_buffer)
 {
        GtkTextBuffer *buffer;
        GtkTextIter insert_iter;
@@ -955,6 +955,15 @@ cursor_moved (GtkSourceBuffer *source_buffer)
        }
 }
 
+/* Although this function is not really useful (update_bracket_highlighting()
+ * could be called directly), the name cursor_moved() is more meaningful.
+ */
+static void
+cursor_moved (GtkSourceBuffer *buffer)
+{
+       update_bracket_highlighting (buffer);
+}
+
 static void
 gtk_source_buffer_content_inserted (GtkTextBuffer *buffer,
                                    gint           start_offset,
@@ -1488,7 +1497,7 @@ gtk_source_buffer_set_highlight_matching_brackets (GtkSourceBuffer *buffer,
        {
                buffer->priv->highlight_brackets = highlight;
 
-               cursor_moved (buffer);
+               update_bracket_highlighting (buffer);
 
                g_object_notify (G_OBJECT (buffer), "highlight-matching-brackets");
        }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]