summaryrefslogtreecommitdiff
path: root/tex/context/base/mkiv/typo-dub.lua
diff options
context:
space:
mode:
Diffstat (limited to 'tex/context/base/mkiv/typo-dub.lua')
-rw-r--r--tex/context/base/mkiv/typo-dub.lua38
1 files changed, 20 insertions, 18 deletions
diff --git a/tex/context/base/mkiv/typo-dub.lua b/tex/context/base/mkiv/typo-dub.lua
index 21953bafd..d0747ae6c 100644
--- a/tex/context/base/mkiv/typo-dub.lua
+++ b/tex/context/base/mkiv/typo-dub.lua
@@ -559,28 +559,30 @@ local function resolve_weak(list,size,start,limit,orderbefore,orderafter)
end
else -- probably more efficient
local runner = start + 2
- local before = list[start]
- local entry = list[start + 1]
- local after = list[runner]
- while after do
- local direction = entry.direction
- if direction == "es" then
- if before.direction == "en" and after.direction == "en" then
- entry.direction = "en"
- end
- elseif direction == "cs" then
- local prevdirection = before.direction
- if prevdirection == "en" then
- if after.direction == "en" then
+ if runner <= limit then
+ local before = list[start]
+ local entry = list[start + 1]
+ local after = list[runner]
+ while after do
+ local direction = entry.direction
+ if direction == "es" then
+ if before.direction == "en" and after.direction == "en" then
entry.direction = "en"
end
- elseif prevdirection == "an" and after.direction == "an" then
- entry.direction = "an"
+ elseif direction == "cs" then
+ local prevdirection = before.direction
+ if prevdirection == "en" then
+ if after.direction == "en" then
+ entry.direction = "en"
+ end
+ elseif prevdirection == "an" and after.direction == "an" then
+ entry.direction = "an"
+ end
end
+ before = current
+ current = after
+ after = list[runner]
end
- before = current
- current = after
- after = list[runner]
end
end
-- W5