From 96fb0771a282485a6c307bc126cafe24c080efb0 Mon Sep 17 00:00:00 2001 From: Emil Ernerfeldt Date: Wed, 27 Jan 2021 20:17:16 +0100 Subject: [PATCH] Fix text layout bug: empty text would lack first row indentation --- epaint/src/text/font.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/epaint/src/text/font.rs b/epaint/src/text/font.rs index c5056d1d..4947af24 100644 --- a/epaint/src/text/font.rs +++ b/epaint/src/text/font.rs @@ -354,7 +354,14 @@ impl Font { paragraph_start = paragraph_end + 1; } - if text.is_empty() || text.ends_with('\n') { + if text.is_empty() { + rows.push(Row { + x_offsets: vec![first_row_indentation], + y_min: cursor_y, + y_max: cursor_y + row_height, + ends_with_newline: false, + }); + } else if text.ends_with('\n') { rows.push(Row { x_offsets: vec![0.0], y_min: cursor_y,