diff --git a/vendor/lite/data/core/init.lua b/vendor/lite/data/core/init.lua index bff35c2..3af4844 100644 --- a/vendor/lite/data/core/init.lua +++ b/vendor/lite/data/core/init.lua @@ -237,8 +237,14 @@ function core.push_clip_rect(x, y, w, h) w, h = r-x, b-y table.insert(core.clip_rect_stack, { x, y, w, h }) renderer.set_clip_rect(x, y, w, h) + return (#core.clip_rect_stack) - 1 end +function core.pop_clip_rect_to(length) + while #core.clip_rect_stack > length do + core.pop_clip_rect() + end +end function core.pop_clip_rect() table.remove(core.clip_rect_stack) diff --git a/vendor/lite/data/core/rootview.lua b/vendor/lite/data/core/rootview.lua index 389525f..ca29726 100644 --- a/vendor/lite/data/core/rootview.lua +++ b/vendor/lite/data/core/rootview.lua @@ -365,9 +365,13 @@ function Node:draw() self:draw_tabs() end local pos, size = self.active_view.position, self.active_view.size - core.push_clip_rect(pos.x, pos.y, size.x + pos.x % 1, size.y + pos.y % 1) - self.active_view:draw() - core.pop_clip_rect() + local clipstate = core.push_clip_rect(pos.x, pos.y, size.x + pos.x % 1, size.y + pos.y % 1) + xpcall(function() self.active_view:draw() end, + function(msg) + love.graphics.setCanvas(nil) + common.draw_text(style.font, { common.color "#ff0000" }, msg .. "\n" .. debug.traceback(), "left", pos.x, pos.y, size.x, size.y) + end) + core.pop_clip_rect_to(clipstate) else local x, y, w, h = self:get_divider_rect() renderer.draw_rect(x, y, w, h, style.divider)