1
0
mirror of https://github.com/SquidDev-CC/CC-Tweaked synced 2025-02-03 12:49:11 +00:00

Fix canvas not always being redrawn on term resize

Paint implements its menu slightly differently to edit, in that it takes
control of the event loop until the menu is closed. This means that the
term_resize event is ignored, and so the canvas not redrawn when the
menu is open.
This commit is contained in:
Jonathan Coates 2023-10-03 18:18:33 +01:00
parent 747a5a53b4
commit 4541decd40
No known key found for this signature in database
GPG Key ID: B9E431FF07C98D06

View File

@ -275,6 +275,12 @@ local function drawCanvas()
end end
end end
local function termResize()
w, h = term.getSize()
drawCanvas()
drawInterface()
end
local menu_choices = { local menu_choices = {
Save = function() Save = function()
if bReadOnly then if bReadOnly then
@ -376,6 +382,8 @@ local function accessMenu()
nMenuPosEnd = nMenuPosEnd + 1 nMenuPosEnd = nMenuPosEnd + 1
nMenuPosStart = nMenuPosEnd nMenuPosStart = nMenuPosEnd
end end
elseif id == "term_resize" then
termResize()
end end
end end
end end
@ -434,9 +442,7 @@ local function handleEvents()
drawInterface() drawInterface()
end end
elseif id == "term_resize" then elseif id == "term_resize" then
w, h = term.getSize() termResize()
drawCanvas()
drawInterface()
end end
end end
end end