mirror of
https://github.com/emilk/egui.git
synced 2026-06-26 22:53:14 -04:00
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:
committed by
GitHub
parent
7872b5b363
commit
e9609ac94e
@@ -913,7 +913,7 @@ impl GalleyCache {
|
||||
"Bad new section range: {new_range:?}"
|
||||
);
|
||||
paragraph_job.sections.push(LayoutSection {
|
||||
leading_space: if start <= new_range.start {
|
||||
leading_space: if start <= section_range.start {
|
||||
*leading_space
|
||||
} else {
|
||||
0.0
|
||||
@@ -1080,15 +1080,7 @@ mod tests {
|
||||
..Default::default()
|
||||
};
|
||||
job.append(
|
||||
"1st paragraph has some leading space.\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 ÅÄÖ.",
|
||||
"1st paragraph has underline and strikethrough, and has some non-ASCII characters:\n ÅÄÖ.",
|
||||
0.0,
|
||||
TextFormat {
|
||||
font_id: FontId::new(15.0, FontFamily::Monospace),
|
||||
@@ -1097,6 +1089,14 @@ mod tests {
|
||||
..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(
|
||||
"3rd paragraph is kind of boring, but has italics.\nAnd a newline",
|
||||
0.0,
|
||||
|
||||
Reference in New Issue
Block a user