[gnome-builder] bufmgr: avoid highlighting while loading files
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] bufmgr: avoid highlighting while loading files
- Date: Thu, 2 Aug 2018 17:23:11 +0000 (UTC)
commit 0b2d41eb4d9ac7f38f6477f24521448be2c24157
Author: Christian Hergert <chergert redhat com>
Date: Thu Aug 2 10:21:27 2018 -0700
bufmgr: avoid highlighting while loading files
This ensures that we don't race against some other components in GSV while
the underlying buffer is loading.
This works around GNOME/gtksourceview#15
src/libide/buffers/ide-buffer-manager.c | 7 +++++++
1 file changed, 7 insertions(+)
---
diff --git a/src/libide/buffers/ide-buffer-manager.c b/src/libide/buffers/ide-buffer-manager.c
index d27670056..fc969e8ec 100644
--- a/src/libide/buffers/ide-buffer-manager.c
+++ b/src/libide/buffers/ide-buffer-manager.c
@@ -72,6 +72,7 @@ typedef struct
IdeProgress *progress;
GtkSourceFileLoader *loader;
guint is_new : 1;
+ guint rehighlight : 1;
IdeWorkbenchOpenFlags flags;
guint line;
guint line_offset;
@@ -512,6 +513,9 @@ ide_buffer_manager_load_file__load_cb (GObject *object,
gtk_text_buffer_set_modified (GTK_TEXT_BUFFER (state->buffer), FALSE);
+ gtk_source_buffer_set_highlight_syntax (GTK_SOURCE_BUFFER (state->buffer),
+ state->rehighlight);
+
/* try to restore the insertion cursor */
if (g_settings_get_boolean (self->settings, "restore-insert-mark"))
gtk_text_buffer_get_iter_at_line_offset (GTK_TEXT_BUFFER (state->buffer), &iter,
@@ -645,6 +649,9 @@ ide_buffer_manager__load_file_query_info_cb (GObject *object,
cancellable = ide_task_get_cancellable (task);
+ state->rehighlight = gtk_source_buffer_get_highlight_syntax (GTK_SOURCE_BUFFER (state->buffer));
+ gtk_source_buffer_set_highlight_syntax (GTK_SOURCE_BUFFER (state->buffer), FALSE);
+
gtk_source_file_loader_load_async (state->loader,
G_PRIORITY_LOW,
cancellable,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]