1
0
mirror of https://github.com/SquidDev-CC/CC-Tweaked synced 2024-11-17 23:34:51 +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
local function termResize()
w, h = term.getSize()
drawCanvas()
drawInterface()
end
local menu_choices = {
Save = function()
if bReadOnly then
@ -376,6 +382,8 @@ local function accessMenu()
nMenuPosEnd = nMenuPosEnd + 1
nMenuPosStart = nMenuPosEnd
end
elseif id == "term_resize" then
termResize()
end
end
end
@ -434,9 +442,7 @@ local function handleEvents()
drawInterface()
end
elseif id == "term_resize" then
w, h = term.getSize()
drawCanvas()
drawInterface()
termResize()
end
end
end