diff options
author | Hans Hagen <pragma@wxs.nl> | 2019-04-29 09:43:01 +0200 |
---|---|---|
committer | Context Git Mirror Bot <phg@phi-gamma.net> | 2019-04-29 09:43:01 +0200 |
commit | c49d2942bae7074f3bd4c04b6ee895cee1697ca3 (patch) | |
tree | d3be20b28f90754e8a3a20461e7bb6134c70707f /tex/context/base/mkiv/strc-reg.lua | |
parent | 0189223a1a40debb4cb3b146ce182eb806cd28f2 (diff) | |
download | context-c49d2942bae7074f3bd4c04b6ee895cee1697ca3.tar.gz |
2019-04-29 09:01:00
Diffstat (limited to 'tex/context/base/mkiv/strc-reg.lua')
-rw-r--r-- | tex/context/base/mkiv/strc-reg.lua | 26 |
1 files changed, 21 insertions, 5 deletions
diff --git a/tex/context/base/mkiv/strc-reg.lua b/tex/context/base/mkiv/strc-reg.lua index 47ba1c533..be3436bd4 100644 --- a/tex/context/base/mkiv/strc-reg.lua +++ b/tex/context/base/mkiv/strc-reg.lua @@ -719,14 +719,30 @@ function registers.compare(a,b) local ka = a.metadata.kind local kb = b.metadata.kind if ka == kb then - local page_a = a.references.realpage - local page_b = b.references.realpage - if not page_a or not page_b then + local ra = a.references + local rb = b.references + local pa = ra.realpage + local pb = rb.realpage + if not pa or not pb then return 0 - elseif page_a < page_b then + elseif pa < pb then return -1 - elseif page_a > page_b then + elseif pa > pb then return 1 + else + -- new, we need to pick the right one of multiple and + -- we want to prevent oscillation in the tuc file so: + local ia = ra.internal + local ib = rb.internal + if not ia or not ib then + return 0 + elseif ia < ib then + return -1 + elseif ia > ib then + return 1 + else + return 0 + end end elseif ka == "see" then return 1 |