[gnome-builder] indenter: only copy indent up to line end



commit 7e65f03cf962231cd9df941cb2598bc4115ba037
Author: Christian Hergert <chergert redhat com>
Date:   Fri Jul 21 02:17:03 2017 -0700

    indenter: only copy indent up to line end
    
    When we do not have an indenter, we try to copy the indentation
    style of gedit. We simply copy the previous line. However, we
    were copying too much information by not stoping at the line
    end.
    
    This caused multiple newline insertions matching up to the
    number of new lines after the insertion cursor (plus the newline
    we added).
    
    https://bugzilla.gnome.org/show_bug.cgi?id=785213

 libide/sourceview/ide-indenter.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
---
diff --git a/libide/sourceview/ide-indenter.c b/libide/sourceview/ide-indenter.c
index 011cf08..9a81305 100644
--- a/libide/sourceview/ide-indenter.c
+++ b/libide/sourceview/ide-indenter.c
@@ -86,7 +86,8 @@ ide_indenter_mimic_source_view (GtkTextView *text_view,
   copy_end = copy_begin;
   while (g_unichar_isspace (gtk_text_iter_get_char (&copy_end)))
     {
-      if (!gtk_text_iter_forward_char (&copy_end))
+      if (gtk_text_iter_ends_line (&copy_end) ||
+          !gtk_text_iter_forward_char (&copy_end))
         break;
     }
 


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