core: Fix formatting texts when they start with any amount of <br>s

This commit is contained in:
Nathan Adams 2023-11-04 00:18:31 +01:00
parent 249454885b
commit 6061186c0f
6 changed files with 19 additions and 0 deletions

View File

@ -634,6 +634,9 @@ impl FormatSpans {
text.push_byte(b'\n');
if let Some(span) = spans.last_mut() {
span.span_length += 1;
} else {
// This must be at the start; make an empty span so our total length is correct
spans.push(TextSpan::with_length_and_format(1, format));
}
}
@ -646,6 +649,9 @@ impl FormatSpans {
text.push_byte(b'\n');
if let Some(span) = spans.last_mut() {
span.span_length += 1;
} else {
// This must be at the start; make an empty span so our total length is correct
spans.push(TextSpan::with_length_and_format(1, format));
}
// Skip push to `format_stack`.
@ -792,6 +798,12 @@ impl FormatSpans {
text.push_byte(b'\n');
if let Some(span) = spans.last_mut() {
span.span_length += 1;
} else {
// This must be at the start; make an empty span so our total length is correct
spans.push(TextSpan::with_length_and_format(
1,
format_stack.last().unwrap().clone(),
));
}
}
_ => {}

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.2 KiB

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,7 @@
num_frames = 1
[image_comparisons.output]
tolerance = 0
[player_options]
with_renderer = { optional = false, sample_count = 1 }