From 9a1307a9147ef8956db9cdc37e42f057d24c3db1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Tue, 20 Apr 2021 16:05:16 +0800 Subject: backward tablefield --- script/core/guide.lua | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'script') diff --git a/script/core/guide.lua b/script/core/guide.lua index c7901448..9e75936a 100644 --- a/script/core/guide.lua +++ b/script/core/guide.lua @@ -108,12 +108,24 @@ function m.searchRefs(status, source, mode) local search + local function checkLastID(id, field, flag) + local lastID = linker.getLastID(root, id) + if lastID then + local newField = id:sub(#lastID + 1) + if field then + newField = newField .. field + end + search(lastID, newField, flag) + end + end + local function searchSource(obj, field, flag) local link = linker.getLink(obj) if not link then return end local id = link.id + checkLastID(id, field, flag) if field then id = id .. field end @@ -186,17 +198,6 @@ function m.searchRefs(status, source, mode) end end - local function checkLastID(id, field, flag) - local lastID = linker.getLastID(root, id) - if lastID then - local newField = id:sub(#lastID + 1) - if field then - newField = newField .. field - end - search(lastID, newField, flag) - end - end - local stackCount = 0 local mark = {} search = function (id, field, flag) @@ -220,7 +221,6 @@ function m.searchRefs(status, source, mode) checkForward(eachLink, field, flag | SEARCH_FLAG.forward) checkBackward(eachLink, field, flag | SEARCH_FLAG.backward) end - checkLastID(id, field, flag) stackCount = stackCount - 1 end -- cgit v1.2.3