From 288a5d415172675fae90aa82d436a380d9075288 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Tue, 6 Apr 2021 11:07:50 -0400 Subject: [PATCH] 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);