fix: make sure line-break algorithm respects available lines
This commit is contained in:
parent
eaf245beaa
commit
e487ceff58
@ -416,7 +416,11 @@ examAutoOccurrence (hash -> seed) rule ExamAutoOccurrenceConfig{..} occurrences
|
|||||||
w = offsets Array.! j - offsets Array.! i
|
w = offsets Array.! j - offsets Array.! i
|
||||||
prevMin <- ST.readArray minima i
|
prevMin <- ST.readArray minima i
|
||||||
let cost = prevMin + widthCost l potWidth w + breakCost'
|
let cost = prevMin + widthCost l potWidth w + breakCost'
|
||||||
|
remainingWords = offsets Array.! Map.size wordMap - offsets Array.! i
|
||||||
|
remainingLineSpace = sum (map snd $ drop lineIx lineLengths)
|
||||||
breakCost'
|
breakCost'
|
||||||
|
| remainingWords > remainingLineSpace
|
||||||
|
= PosInf
|
||||||
| j < Map.size wordMap
|
| j < Map.size wordMap
|
||||||
, j > 0
|
, j > 0
|
||||||
= breakCost (wordIx # pred j) (wordIx # j)
|
= breakCost (wordIx # pred j) (wordIx # j)
|
||||||
|
|||||||
Reference in New Issue
Block a user