diff options
| author | Laurenz <laurmaedje@gmail.com> | 2022-09-19 10:42:54 +0200 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2022-09-19 10:42:54 +0200 |
| commit | e5615ce02d2507025c0ef51e79f232f89703b7cc (patch) | |
| tree | 983ab6339b3a98e5268ba91d882ea08e9921a81a /src | |
| parent | 65c4ee42e7f30c894a9795a26de837afe9beb56b (diff) | |
Fix cost if last line is justified
Diffstat (limited to 'src')
| -rw-r--r-- | src/library/text/par.rs | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/src/library/text/par.rs b/src/library/text/par.rs index 38240b3d..6c5c9765 100644 --- a/src/library/text/par.rs +++ b/src/library/text/par.rs @@ -780,16 +780,12 @@ fn linebreak_optimized<'a>( // this breakpoint. active = i + 1; MAX_COST - } else if eof { - // This is the final line and its not overfull since then we - // would have taken the above branch. - 0.0 - } else if mandatory { + } else if mandatory || eof { // This is a mandatory break and the line is not overfull, so it // has minimum cost. All breakpoints before this one become // inactive since no line can span above the mandatory break. active = k; - MIN_COST + MIN_COST + if attempt.justify { ratio.powi(3).abs() } else { 0.0 } } else { // Normal line with cost of |ratio^3|. ratio.powi(3).abs() |
