[gtksourceview/gnome-3-12] Draw spaces: fix regression



commit 5e62006c35d7b9d294df1410dae41b6a00619b8b
Author: Arpad Borsos <arpad borsos googlemail com>
Date:   Thu May 29 16:12:13 2014 +0200

    Draw spaces: fix regression
    
    gtk_text_iter_forward_to_line_end says:
    If the iterator is already at the paragraph delimiter characters, moves
    to the paragraph delimiter characters for the next line.
    
    Because of this, get_end_iter treated the whole line following a blank
    line as "inside text".
    Similarly, get_leading_trailing also treated the whole line following a
    blank as "trailing".
    
    https://bugzilla.gnome.org/show_bug.cgi?id=730713

 gtksourceview/gtksourceview.c |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)
---
diff --git a/gtksourceview/gtksourceview.c b/gtksourceview/gtksourceview.c
index a169a75..2775604 100644
--- a/gtksourceview/gtksourceview.c
+++ b/gtksourceview/gtksourceview.c
@@ -2042,7 +2042,10 @@ get_leading_trailing (GtkTextIter *iter,
 
        /* Find start of trailing */
        start = *iter;
-       gtk_text_iter_forward_to_line_end (&start);
+       if (!gtk_text_iter_ends_line (&start))
+       {
+               gtk_text_iter_forward_to_line_end (&start);
+       }
 
        while (TRUE)
        {
@@ -2110,7 +2113,10 @@ get_end_iter (GtkTextView *text_view,
        GdkRectangle rect;
 
        *end_iter = *start_iter;
-       gtk_text_iter_forward_to_line_end (end_iter);
+       if (!gtk_text_iter_ends_line (end_iter))
+       {
+               gtk_text_iter_forward_to_line_end (end_iter);
+       }
 
        /* check if end_iter is inside the bounding box anyway */
        gtk_text_view_get_iter_location (text_view, end_iter, &rect);


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