From 5d2d09fbcf475c73959f9e5c5a93a7171467b56b Mon Sep 17 00:00:00 2001 From: XeonSquared Date: Thu, 9 Apr 2020 13:48:34 +1000 Subject: [PATCH] more control code support for the terminal emulator --- module/vt100.lua | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/module/vt100.lua b/module/vt100.lua index b709237..01bc49d 100644 --- a/module/vt100.lua +++ b/module/vt100.lua @@ -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)