[gnome-text-editor] document: disable highlight-matching-brackets during load



commit 90996cd1c4ec5dcbe18328ff5d01afe3153d36d8
Author: Christian Hergert <chergert redhat com>
Date:   Mon Aug 1 13:07:44 2022 -0700

    document: disable highlight-matching-brackets during load
    
    This helps ensure we will do less work in GtkSourceBuffer while the
    document is loading. Patches have also just landed in GSV to try to do
    less work, even if this isn't set for cases where other applications may
    not be doing the right thing. But combined, they are even less work.
    
    Related #444

 src/editor-document.c | 6 ++++++
 1 file changed, 6 insertions(+)
---
diff --git a/src/editor-document.c b/src/editor-document.c
index fa5d99f..d61ca0a 100644
--- a/src/editor-document.c
+++ b/src/editor-document.c
@@ -83,6 +83,7 @@ typedef struct
   gint64           modified_at;
   guint            n_active;
 
+  guint            highlight_matching_brackets : 1;
   guint            highlight_syntax : 1;
   guint            check_spelling : 1;
   guint            has_draft : 1;
@@ -1403,6 +1404,7 @@ editor_document_query_info_cb (GObject      *object,
 
   editor_buffer_monitor_reset (self->monitor);
 
+  gtk_source_buffer_set_highlight_matching_brackets (GTK_SOURCE_BUFFER (self), 
load->highlight_matching_brackets);
   gtk_source_buffer_set_highlight_syntax (GTK_SOURCE_BUFFER (self), load->highlight_syntax);
   editor_text_buffer_spell_adapter_set_enabled (self->spell_adapter, load->check_spelling);
 
@@ -1484,6 +1486,7 @@ editor_document_do_load (EditorDocument *self,
       /* We are creating a new file. */
       editor_document_set_busy_progress (self, 1, 2, 1.0);
       _editor_document_unmark_busy (self);
+      gtk_source_buffer_set_highlight_matching_brackets (GTK_SOURCE_BUFFER (self), 
load->highlight_matching_brackets);
       gtk_source_buffer_set_highlight_syntax (GTK_SOURCE_BUFFER (self), load->highlight_syntax);
       editor_text_buffer_spell_adapter_set_enabled (self->spell_adapter, load->check_spelling);
       g_task_return_boolean (task, TRUE);
@@ -1714,6 +1717,8 @@ _editor_document_load_async (EditorDocument      *self,
   else
     load->mount_operation = g_mount_operation_new ();
 
+  load->highlight_matching_brackets =
+      gtk_source_buffer_get_highlight_matching_brackets (GTK_SOURCE_BUFFER (self));
   load->highlight_syntax =
       gtk_source_buffer_get_highlight_syntax (GTK_SOURCE_BUFFER (self));
   load->check_spelling =
@@ -1737,6 +1742,7 @@ _editor_document_load_async (EditorDocument      *self,
    * and reduce the chances that syntax highlights can hit scenarios
    * where text changes during the main loop idle callbacks.
    */
+  gtk_source_buffer_set_highlight_matching_brackets (GTK_SOURCE_BUFFER (self), FALSE);
   gtk_source_buffer_set_highlight_syntax (GTK_SOURCE_BUFFER (self), FALSE);
   editor_text_buffer_spell_adapter_set_enabled (self->spell_adapter, FALSE);
 


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