Fix `leading_space` sometimes being ignored during paragraph splitting (#7031)
Fixes a regression introduced in https://github.com/emilk/egui/pull/5411
(possibly
d74bee536f)
that breaks `leading_space` handling.
I think this is what the condition should be but I haven't touched this
code in a while.
This commit is contained in:
parent
7872b5b363
commit
e9609ac94e
|
|
@ -913,7 +913,7 @@ impl GalleyCache {
|
||||||
"Bad new section range: {new_range:?}"
|
"Bad new section range: {new_range:?}"
|
||||||
);
|
);
|
||||||
paragraph_job.sections.push(LayoutSection {
|
paragraph_job.sections.push(LayoutSection {
|
||||||
leading_space: if start <= new_range.start {
|
leading_space: if start <= section_range.start {
|
||||||
*leading_space
|
*leading_space
|
||||||
} else {
|
} else {
|
||||||
0.0
|
0.0
|
||||||
|
|
@ -1080,15 +1080,7 @@ mod tests {
|
||||||
..Default::default()
|
..Default::default()
|
||||||
};
|
};
|
||||||
job.append(
|
job.append(
|
||||||
"1st paragraph has some leading space.\n",
|
"1st paragraph has underline and strikethrough, and has some non-ASCII characters:\n ÅÄÖ.",
|
||||||
16.0,
|
|
||||||
TextFormat {
|
|
||||||
font_id: FontId::new(14.0, FontFamily::Proportional),
|
|
||||||
..Default::default()
|
|
||||||
},
|
|
||||||
);
|
|
||||||
job.append(
|
|
||||||
"2nd paragraph has underline and strikthrough, and has some non-ASCII characters:\n ÅÄÖ.",
|
|
||||||
0.0,
|
0.0,
|
||||||
TextFormat {
|
TextFormat {
|
||||||
font_id: FontId::new(15.0, FontFamily::Monospace),
|
font_id: FontId::new(15.0, FontFamily::Monospace),
|
||||||
|
|
@ -1097,6 +1089,14 @@ mod tests {
|
||||||
..Default::default()
|
..Default::default()
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
job.append(
|
||||||
|
"2nd paragraph has some leading space.\n",
|
||||||
|
16.0,
|
||||||
|
TextFormat {
|
||||||
|
font_id: FontId::new(14.0, FontFamily::Proportional),
|
||||||
|
..Default::default()
|
||||||
|
},
|
||||||
|
);
|
||||||
job.append(
|
job.append(
|
||||||
"3rd paragraph is kind of boring, but has italics.\nAnd a newline",
|
"3rd paragraph is kind of boring, but has italics.\nAnd a newline",
|
||||||
0.0,
|
0.0,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue