[gnome-builder/auto-indent] auto-indenter: try to find local scope if we failed to locate expression.



commit 67cc2fa06b5fc47af6c199c522f6b8737813c5fd
Author: Christian Hergert <christian hergert me>
Date:   Thu Sep 18 13:22:24 2014 -0700

    auto-indenter: try to find local scope if we failed to locate expression.

 src/editor/gb-source-auto-indenter-c.c |   13 ++++---------
 1 files changed, 4 insertions(+), 9 deletions(-)
---
diff --git a/src/editor/gb-source-auto-indenter-c.c b/src/editor/gb-source-auto-indenter-c.c
index bc69096..3be2b8a 100644
--- a/src/editor/gb-source-auto-indenter-c.c
+++ b/src/editor/gb-source-auto-indenter-c.c
@@ -158,6 +158,7 @@ backward_find_stmt_expr (GtkTextIter *iter)
   return FALSE;
 }
 
+#if 0
 static guint
 backward_to_line_first_char (GtkTextIter *iter)
 {
@@ -181,6 +182,7 @@ backward_to_line_first_char (GtkTextIter *iter)
 
   return gtk_text_iter_get_line_offset (iter);
 }
+#endif
 
 static gboolean
 non_space_predicate (gunichar ch,
@@ -374,19 +376,12 @@ gb_source_auto_indenter_c_indent (GbSourceAutoIndenterC *c,
     {
       guint offset;
 
-      if (!backward_find_stmt_expr (iter))
-        {
-          gtk_text_iter_assign (iter, &cur);
-          offset = backward_to_line_first_char (iter);
-          build_indent (c, offset, iter, str);
-        }
-      else
+      if (backward_find_stmt_expr (iter))
         {
           offset = gtk_text_iter_get_line_offset (iter);
           build_indent (c, offset, iter, str);
+          GOTO (cleanup);
         }
-
-      GOTO (cleanup);
     }
 
   /*


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