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
function findBoundaries(tbl)
local foundStart = false
local tildeStr = string.rep("~", 79)
for i,v in ipairs(tbl) do
if v[1].text == tildeStr or v[1].text:find("No more new") then
foundStart = true
break
else
table.remove(tbl, i)
end
for indexStart,v in ipairs(tbl) do
if v[1].text == tildeStr then
for indexEnd = #tbl, 1, -1 do
if tbl[indexEnd][1].text == tildeStr then
table.move(tbl, indexStart, indexEnd, 1)
local len = indexEnd - indexStart + 1
table.move(tbl, #tbl + 1, #tbl*2 - len, len + 1)
return tbl
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
return tbl
end

Loading…
Cancel
Save