Skip to content

Commit

Permalink
Merge 64e8d3b into 4276c71
Browse files Browse the repository at this point in the history
  • Loading branch information
alerque committed Feb 21, 2024
2 parents 4276c71 + 64e8d3b commit 3b76ca6
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions core/utilities.lua
Expand Up @@ -616,9 +616,11 @@ utilities.breadcrumbs = function ()
return self[#SILE.traceStack-(count or 1)]
end

function breadcrumbs:contains (needle)
for i, command in ipairs(self) do
if command == needle then return true, #self - i end
function breadcrumbs:contains (needle, startdepth)
startdepth = startdepth or 0
for i = startdepth, #SILE.traceStack - 1 do
local frame = SILE.traceStack[#SILE.traceStack-i]
if frame.command == needle then return true, #self - i end
end
return false, -1
end
Expand Down

0 comments on commit 3b76ca6

Please sign in to comment.