Fix text layout bug: empty text would lack first row indentation
This commit is contained in:
parent
6029a438a2
commit
96fb0771a2
1 changed files with 8 additions and 1 deletions
|
@ -354,7 +354,14 @@ impl Font {
|
||||||
paragraph_start = paragraph_end + 1;
|
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 {
|
rows.push(Row {
|
||||||
x_offsets: vec![0.0],
|
x_offsets: vec![0.0],
|
||||||
y_min: cursor_y,
|
y_min: cursor_y,
|
||||||
|
|
Loading…
Reference in a new issue