diff --git a/crates/epaint/src/text/fonts.rs b/crates/epaint/src/text/fonts.rs index 871cecabdb1..2e0343d6d4d 100644 --- a/crates/epaint/src/text/fonts.rs +++ b/crates/epaint/src/text/fonts.rs @@ -807,6 +807,9 @@ impl GalleyCache { let current_offset = emath::vec2(0.0, merged_galley.rect.height()); let mut rows = galley.rows.iter(); + // As documented in `Row::ends_with_newline`, a '\n' will always create a + // new `Row` immediately below the current one. Here it doesn't make sense + // for us to append this new row so we just ignore it. if i != galleys.len() - 1 && !galley.elided { let popped = rows.next_back(); debug_assert_eq!(popped.unwrap().row.glyphs.len(), 0); diff --git a/crates/epaint/src/text/text_layout_types.rs b/crates/epaint/src/text/text_layout_types.rs index b3d26764e18..3ebf07b8f5e 100644 --- a/crates/epaint/src/text/text_layout_types.rs +++ b/crates/epaint/src/text/text_layout_types.rs @@ -581,7 +581,7 @@ pub struct Row { pub visuals: RowVisuals, /// If true, this [`Row`] came from a paragraph ending with a `\n`. - /// The `\n` itself is omitted from [`glyphs`]. + /// The `\n` itself is omitted from [`Self::glyphs`]. /// A `\n` in the input text always creates a new [`Row`] below it, /// so that text that ends with `\n` has an empty [`Row`] last. /// This also implies that the last [`Row`] in a [`Galley`] always has `ends_with_newline == false`.