core: Fix formatting texts when they start with any amount of <br>s
This commit is contained in:
parent
249454885b
commit
6061186c0f
|
@ -634,6 +634,9 @@ impl FormatSpans {
|
||||||
text.push_byte(b'\n');
|
text.push_byte(b'\n');
|
||||||
if let Some(span) = spans.last_mut() {
|
if let Some(span) = spans.last_mut() {
|
||||||
span.span_length += 1;
|
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');
|
text.push_byte(b'\n');
|
||||||
if let Some(span) = spans.last_mut() {
|
if let Some(span) = spans.last_mut() {
|
||||||
span.span_length += 1;
|
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`.
|
// Skip push to `format_stack`.
|
||||||
|
@ -792,6 +798,12 @@ impl FormatSpans {
|
||||||
text.push_byte(b'\n');
|
text.push_byte(b'\n');
|
||||||
if let Some(span) = spans.last_mut() {
|
if let Some(span) = spans.last_mut() {
|
||||||
span.span_length += 1;
|
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.
|
@ -0,0 +1,7 @@
|
||||||
|
num_frames = 1
|
||||||
|
|
||||||
|
[image_comparisons.output]
|
||||||
|
tolerance = 0
|
||||||
|
|
||||||
|
[player_options]
|
||||||
|
with_renderer = { optional = false, sample_count = 1 }
|
Loading…
Reference in New Issue