[gnome-builder] sourceview: avoid work when loading the buffer
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] sourceview: avoid work when loading the buffer
- Date: Sun, 18 Jun 2017 08:03:56 +0000 (UTC)
commit 400a54980d829431b29bfe544f5d6467f93eefcd
Author: Christian Hergert <chergert redhat com>
Date: Sun Jun 18 01:01:33 2017 -0700
sourceview: avoid work when loading the buffer
When we are loading the buffer, we want to avoid various work like
checking snippets and such.
libide/sourceview/ide-source-view.c | 18 +++++++++---------
1 files changed, 9 insertions(+), 9 deletions(-)
---
diff --git a/libide/sourceview/ide-source-view.c b/libide/sourceview/ide-source-view.c
index 79e23ca..9d41597 100644
--- a/libide/sourceview/ide-source-view.c
+++ b/libide/sourceview/ide-source-view.c
@@ -1240,12 +1240,13 @@ ide_source_view__buffer_insert_text_cb (IdeSourceView *self,
IdeSourceViewPrivate *priv = ide_source_view_get_instance_private (self);
IdeSourceSnippet *snippet;
- IDE_ENTRY;
-
g_assert (IDE_IS_SOURCE_VIEW (self));
g_assert (iter != NULL);
g_assert (text != NULL);
- g_assert (GTK_IS_TEXT_BUFFER (buffer));
+ g_assert (IDE_IS_BUFFER (buffer));
+
+ if (_ide_buffer_get_loading (IDE_BUFFER (buffer)))
+ return;
gtk_text_buffer_begin_user_action (buffer);
@@ -1255,8 +1256,6 @@ ide_source_view__buffer_insert_text_cb (IdeSourceView *self,
ide_source_snippet_before_insert_text (snippet, buffer, iter, text, len);
ide_source_view_unblock_handlers (self);
}
-
- IDE_EXIT;
}
static void
@@ -1270,12 +1269,13 @@ ide_source_view__buffer_insert_text_after_cb (IdeSourceView *self,
IdeSourceSnippet *snippet;
GtkTextIter insert;
- IDE_ENTRY;
-
g_assert (IDE_IS_SOURCE_VIEW (self));
g_assert (iter != NULL);
g_assert (text != NULL);
- g_assert (GTK_IS_TEXT_BUFFER (buffer));
+ g_assert (IDE_IS_BUFFER (buffer));
+
+ if (_ide_buffer_get_loading (IDE_BUFFER (buffer)))
+ return;
if (NULL != (snippet = g_queue_peek_head (priv->snippets)))
{
@@ -1313,7 +1313,7 @@ ide_source_view__buffer_insert_text_after_cb (IdeSourceView *self,
gtk_text_buffer_end_user_action (buffer);
- IDE_EXIT;
+ return;
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]