generalized canvas

This commit is contained in:
kepler155c@gmail.com
2017-10-05 13:07:48 -04:00
parent 8e381d3ebf
commit 19ed191086
8 changed files with 467 additions and 354 deletions

View File

@@ -27,13 +27,17 @@ if not socket then
error('Unable to connect to ' .. remoteId .. ' on port 5900')
end
local w, h = term.getSize()
socket:write({
type = 'termInfo',
width = w,
height = h,
isColor = term.isColor(),
})
local function writeTermInfo()
local w, h = term.getSize()
socket:write({
type = 'termInfo',
width = w,
height = h,
isColor = term.isColor(),
})
end
writeTermInfo()
local ct = Util.shallowCopy(term.current())
@@ -57,7 +61,7 @@ ct.clear()
ct.setCursorPos(1, 1)
local filter = Util.transpose({
'char', 'paste', 'key', 'key_up',
'char', 'paste', 'key', 'key_up',
'mouse_scroll', 'mouse_click', 'mouse_drag', 'mouse_up',
})
@@ -78,6 +82,8 @@ while true do
type = 'shellRemote',
event = e,
})
elseif event == 'term_resize' then
writeTermInfo()
elseif event == 'terminate' then
socket:close()
ct.setBackgroundColor(colors.black)