Discard paragraph fill after a break that consumes the tail
This commit is contained in:
1 parent
767c8ffced
commit
a93d1bb902
5 files changed
+103
-11
No files matched your search
@@ -48,6 +48,45 @@ fn normalize(s: &str) -> String {
|
||||
.replace('ffl', "ffl")
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn paragraph_fill_is_discarded_after_a_break_that_consumes_the_tail() {
|
||||
let e = run(
|
||||
r"\hsize=10pt
|
||||
\noindent\hbox to10pt{A\hss}\penalty0
|
||||
\hbox to10pt{B\hss}\hskip1pt minus1pt\hskip0pt\par
|
||||
\rightskip=0pt plus1fil \parfillskip=0pt plus2fil
|
||||
\noindent\hbox to10pt{A\hss}\penalty-10000\hskip0pt\par
|
||||
\noindent\hskip1pt\par",
|
||||
);
|
||||
let p = paragraphs(&e);
|
||||
assert_eq!(line_text(p[0]), ["A", "B"]);
|
||||
assert_eq!(p[0].badness, [0, 100]);
|
||||
|
||||
// A forced break can still leave a blank line, stretched by rightskip.
|
||||
assert_eq!(line_text(p[1]), ["A", ""]);
|
||||
let BoxContent::Horizontal(nodes) = &p[1].line_boxes[1].content else {
|
||||
panic!("expected horizontal line");
|
||||
};
|
||||
assert!(matches!(
|
||||
nodes.as_slice(),
|
||||
[TextNode::NamedGlue(_, Parameter::Rightskip)]
|
||||
));
|
||||
|
||||
// No previous break prunes the sole line of this glue-only paragraph.
|
||||
assert_eq!(p[2].line_boxes.len(), 1);
|
||||
let BoxContent::Horizontal(nodes) = &p[2].line_boxes[0].content else {
|
||||
panic!("expected horizontal line");
|
||||
};
|
||||
assert!(matches!(
|
||||
nodes.as_slice(),
|
||||
[
|
||||
TextNode::Penalty(10000),
|
||||
TextNode::NamedGlue(_, Parameter::Parfillskip),
|
||||
TextNode::NamedGlue(_, Parameter::Rightskip),
|
||||
]
|
||||
));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn native_parameters_have_scopes_and_par_end_timing() {
|
||||
let e = run(
|
||||
|
||||
Reference in new issue
Block a user