mirror of
https://github.com/emilk/egui.git
synced 2026-06-27 07:03:14 -04:00
Fix Row::ends_with_newline docs, explain skipping of last galley row
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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`.
|
||||
|
||||
Reference in New Issue
Block a user