[gnome-builder] auto-indent: fix indent after c89 comment



commit d5ee2287805efaab070606c7a5dba42d11f1012f
Author: Christian Hergert <christian hergert me>
Date:   Thu Oct 16 23:57:27 2014 -0700

    auto-indent: fix indent after c89 comment
    
    "/* foo */\n" would still cause an extra " * " to be inserted.

 src/auto-indent/gb-source-auto-indenter-c.c |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)
---
diff --git a/src/auto-indent/gb-source-auto-indenter-c.c b/src/auto-indent/gb-source-auto-indenter-c.c
index aec90d9..bf3ee2f 100644
--- a/src/auto-indent/gb-source-auto-indenter-c.c
+++ b/src/auto-indent/gb-source-auto-indenter-c.c
@@ -453,10 +453,14 @@ in_c89_comment (const GtkTextIter *location,
 {
   GtkTextBuffer *buffer;
   GtkTextIter iter;
+  GtkTextIter after_location;
 
   buffer = gtk_text_iter_get_buffer (location);
   gtk_text_buffer_get_start_iter (buffer, &iter);
 
+  after_location = *location;
+  gtk_text_iter_forward_char (&after_location);
+
   do
     {
       gunichar ch;
@@ -474,11 +478,10 @@ in_c89_comment (const GtkTextIter *location,
           if (!gtk_text_iter_forward_chars (&iter, 2) ||
               !gtk_text_iter_forward_search (&iter, "*/",
                                              GTK_TEXT_SEARCH_TEXT_ONLY,
-                                             NULL, &iter, NULL) ||
-              (gtk_text_iter_compare (&iter, location) > 0))
+                                             NULL, &iter, &after_location))
             {
               *match_begin = saved;
-              return TRUE;
+              RETURN (TRUE);
             }
         }
 


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