[gnome-builder] auto-indent: fix { after else.



commit f7aab917ce38c2b41b465517b8cc9381fd459726
Author: Christian Hergert <christian hergert me>
Date:   Fri Sep 19 15:07:39 2014 -0700

    auto-indent: fix { after else.

 src/editor/gb-source-auto-indenter-c.c |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)
---
diff --git a/src/editor/gb-source-auto-indenter-c.c b/src/editor/gb-source-auto-indenter-c.c
index 302d528..14d9438 100644
--- a/src/editor/gb-source-auto-indenter-c.c
+++ b/src/editor/gb-source-auto-indenter-c.c
@@ -538,11 +538,13 @@ gb_source_auto_indenter_c_indent (GbSourceAutoIndenterC *c,
     }
 
   /*
-   * Check to see if we are after else or do
+   * Check to see if we are after else or do. Skip if we see '{'
+   * so that we can fallback to regular scoping rules.
    */
   last_word = backward_last_word (iter, &match_begin);
-  if ((g_strcmp0 (last_word, "else") == 0) ||
-      (g_strcmp0 (last_word, "do") == 0))
+  if ((ch != '{') &&
+      ((g_strcmp0 (last_word, "else") == 0) ||
+       (g_strcmp0 (last_word, "do") == 0)))
     {
       guint offset;
 


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