diff options
author | Hans Hagen <pragma@wxs.nl> | 2019-12-17 17:22:50 +0100 |
---|---|---|
committer | Context Git Mirror Bot <phg@phi-gamma.net> | 2019-12-17 17:22:50 +0100 |
commit | d1f4da02201fd33c139ee1756296e8df53580ff7 (patch) | |
tree | d24fad194af62020481cac8d2041913a36789e8a /tex/context/base/mkiv/page-mix.lua | |
parent | 37cca59f16fc3ab5bf3ce19fd94161d1c2f6ffdc (diff) | |
download | context-d1f4da02201fd33c139ee1756296e8df53580ff7.tar.gz |
2019-12-17 16:25:00
Diffstat (limited to 'tex/context/base/mkiv/page-mix.lua')
-rw-r--r-- | tex/context/base/mkiv/page-mix.lua | 94 |
1 files changed, 49 insertions, 45 deletions
diff --git a/tex/context/base/mkiv/page-mix.lua b/tex/context/base/mkiv/page-mix.lua index d64646d8a..dacc829d7 100644 --- a/tex/context/base/mkiv/page-mix.lua +++ b/tex/context/base/mkiv/page-mix.lua @@ -349,49 +349,50 @@ local function preparesplit(specification) -- a rather large function lastcontent = nil end - -- local function backtrack(start) - -- local current = start - -- -- first skip over glue and penalty - -- while current do - -- local id = getid(current) - -- if id == glue_code then - -- if trace_state then - -- report_state("backtracking over %s in column %s, value %p","glue",column,getwidth(current)) - -- end - -- current = getprev(current) - -- elseif id == penalty_code then - -- if trace_state then - -- report_state("backtracking over %s in column %s, value %i","penalty",column,getpenalty(current)) - -- end - -- else - -- break - -- end - -- end - -- -- then skip over content - -- while current do - -- local id = getid(current) - -- if id == glue_code then - -- if trace_state then - -- report_state("quitting at %s in column %s, value %p","glue",column,getwidth(current)) - -- end - -- break - -- elseif id == penalty_code then - -- if trace_state then - -- report_state("quitting at %s in column %s, value %i","penalty",column,getpenalty(current)) - -- end - -- break - -- else - -- current = getprev(current) - -- end - -- end - -- if not current then - -- if trace_state then - -- report_state("no effective backtracking in column %s",column) - -- end - -- current = start - -- end - -- return current - -- end + local function backtrack(start) + local current = start + -- first skip over glue and penalty + while current do + local id = getid(current) + if id == glue_code then + if trace_state then + report_state("backtracking over %s in column %s, value %p","glue",column,getwidth(current)) + end + current = getprev(current) + elseif id == penalty_code then + if trace_state then + report_state("backtracking over %s in column %s, value %i","penalty",column,getpenalty(current)) + end + current = getprev(current) + else + break + end + end + -- then skip over content + while current do + local id = getid(current) + if id == glue_code then + if trace_state then + report_state("quitting at %s in column %s, value %p","glue",column,getwidth(current)) + end + break + elseif id == penalty_code then + if trace_state then + report_state("quitting at %s in column %s, value %i","penalty",column,getpenalty(current)) + end + break + else + current = getprev(current) + end + end + if not current then + if trace_state then + report_state("no effective backtracking in column %s",column) + end + current = start + end + return current + end local function gotonext() if lastcurrent then @@ -400,8 +401,11 @@ local function preparesplit(specification) -- a rather large function report_state("backtracking to preferred break in column %s",column) end -- todo: also remember height/depth - -- current = backtrack(lastcurrent) -- not ok, we go to far back so why was this needed - current = lastcurrent + if true then -- todo: option to disable this + current = backtrack(lastcurrent) -- not ok yet + else + current = lastcurrent + end backtracked = true end lastcurrent = nil |