[gtk/textview-last-line] textview: Fix a problem with the last line




commit 288a5d415172675fae90aa82d436a380d9075288
Author: Matthias Clasen <mclasen redhat com>
Date:   Tue Apr 6 11:07:50 2021 -0400

    textview: Fix a problem with the last line
    
    Sometimes, we missed the last line for display.
    
    Fixes: #3835

 gtk/gtktextlayout.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
---
diff --git a/gtk/gtktextlayout.c b/gtk/gtktextlayout.c
index 0d808d6bfb..d127c489b2 100644
--- a/gtk/gtktextlayout.c
+++ b/gtk/gtktextlayout.c
@@ -4114,7 +4114,7 @@ gtk_text_layout_snapshot (GtkTextLayout      *layout,
   gtk_text_layout_wrap_loop_start (layout);
 
   for (GtkTextLine *line = first_line;
-       line != last_line;
+       line != NULL;
        line = _gtk_text_line_next_excluding_last (line))
     {
       GtkTextLineDisplay *line_display;
@@ -4222,6 +4222,9 @@ gtk_text_layout_snapshot (GtkTextLayout      *layout,
       offset_y += line_display->height;
 
       gtk_text_line_display_unref (line_display);
+
+      if (line == last_line)
+        break;
     }
 
   gtk_text_layout_wrap_loop_end (layout);


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