[gnome-builder] sourceview: ensure indenter is disabled



commit e1bed9427f353a93d15d671ce91ace3dfbd43be0
Author: Christian Hergert <chergert redhat com>
Date:   Mon Oct 16 02:06:59 2017 -0700

    sourceview: ensure indenter is disabled
    
    When auto-indent is set to FALSE, we want to be sure that the
    indenter is disabled. So clear our extension match until it
    has been re-enabled or the language changed.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=789042

 src/libide/sourceview/ide-source-view.c |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)
---
diff --git a/src/libide/sourceview/ide-source-view.c b/src/libide/sourceview/ide-source-view.c
index eaebab4..60590d6 100644
--- a/src/libide/sourceview/ide-source-view.c
+++ b/src/libide/sourceview/ide-source-view.c
@@ -748,10 +748,23 @@ static void
 ide_source_view_update_auto_indent_override (IdeSourceView *self)
 {
   IdeSourceViewPrivate *priv = ide_source_view_get_instance_private (self);
+  GtkSourceLanguage *language;
+  const gchar *lang_id = NULL;
   IdeIndenter *indenter;
 
   g_assert (IDE_IS_SOURCE_VIEW (self));
 
+  /* Update the indenter if necessary */
+  if (priv->auto_indent &&
+      priv->indenter_adapter != NULL &&
+      priv->buffer != NULL &&
+      NULL != (language = gtk_source_buffer_get_language (GTK_SOURCE_BUFFER (priv->buffer))))
+    lang_id = gtk_source_language_get_id (language);
+
+  if (priv->indenter_adapter != NULL)
+    ide_extension_adapter_set_value (priv->indenter_adapter, lang_id);
+
+  /* Fetch our indenter */
   indenter = ide_source_view_get_indenter (self);
 
   /*


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