summaryrefslogtreecommitdiff
path: root/script-beta/core/reference.lua
diff options
context:
space:
mode:
Diffstat (limited to 'script-beta/core/reference.lua')
-rw-r--r--script-beta/core/reference.lua16
1 files changed, 12 insertions, 4 deletions
diff --git a/script-beta/core/reference.lua b/script-beta/core/reference.lua
index e61e2940..bd4cd6b7 100644
--- a/script-beta/core/reference.lua
+++ b/script-beta/core/reference.lua
@@ -11,16 +11,24 @@ end
local function sortResults(results)
-- 先按照顺序排序
table.sort(results, function (a, b)
- return a.target.start < b.target.start
+ local u1 = guide.getRoot(a).uri
+ local u2 = guide.getRoot(b).uri
+ if u1 == u2 then
+ return a.target.start < b.target.start
+ else
+ return u1 < u2
+ end
end)
-- 如果2个结果处于嵌套状态,则取范围小的那个
- local lf
+ local lf, lu
for i = #results, 1, -1 do
local res = results[i].target
- local f = res.finish
- if lf and f > lf then
+ local f = res.finish
+ local uri = guide.getRoot(res).uri
+ if lf and f > lf and uri == lu then
table.remove(results, i)
else
+ lu = uri
lf = f
end
end