Changes to findBoundaries for efficiency.

master
AardCrowley 2 years ago committed by GitHub
parent 776f922657
commit 297d154aec
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -88,29 +88,19 @@ function startNoteList(name, line, wildcards)
end end
function findBoundaries(tbl) function findBoundaries(tbl)
local foundStart = false
local tildeStr = string.rep("~", 79) local tildeStr = string.rep("~", 79)
for indexStart,v in ipairs(tbl) do
for i,v in ipairs(tbl) do if v[1].text == tildeStr then
for indexEnd = #tbl, 1, -1 do
if v[1].text == tildeStr or v[1].text:find("No more new") then if tbl[indexEnd][1].text == tildeStr then
foundStart = true table.move(tbl, indexStart, indexEnd, 1)
break local len = indexEnd - indexStart + 1
else table.move(tbl, #tbl + 1, #tbl*2 - len, len + 1)
table.remove(tbl, i) return tbl
end end
end
if foundStart then
for i = #tbl, 1, -1 do
if tbl[i][1].text == tildeStr or tbl[i][1].text:find("There are no") or tbl[i][1].text:find("Changed") then
break
else
table.remove(tbl, i)
end end
end end
end end
return tbl return tbl
end end

Loading…
Cancel
Save