more control code support for the terminal emulator

This commit is contained in:
Izaya 2020-04-09 13:48:34 +10:00
parent 67de47ebd4
commit 5d2d09fbcf

View File

@ -14,7 +14,7 @@ function vt100emu(gpu) -- takes GPU component proxy *gpu* and returns a function
gpu.setResolution(mx,my)
gpu.fill(1,1,mx,my," ")
function termwrite(s)
local function termwrite(s)
local rs = ""
s=s:gsub("\8","\27[D")
pc = gpu.get(cx,cy)
@ -81,6 +81,23 @@ function vt100emu(gpu) -- takes GPU component proxy *gpu* and returns a function
rs = string.format("%s\27[%d;%d0c",rs,mx,my)
elseif cc == "n" and lc == "6" then
rs = string.format("%s\27[%d;%dR",rs,cx,cy)
elseif cc == "K" then
if lc == "1" then
gpu.fill(1,cy,cx,1," ")
elseif lc == "2" then
gpu.fill(cx,cy,mx,1," ")
else
gpu.fill(1,cy,mx,1," ")
end
elseif cc == "J" then
if lc == "1" then
gpu.fill(1,1,mx,cy," ")
elseif lc == "2" then
gpu.full(1,1,mx,my," ")
cx,cy = 1, 1
else
gpu.fill(1,cy,mx,my," ")
end
elseif cc == "m" then
for num in cs:gmatch("%d+") do
num=tonumber(num)