From 578a9e966f2cb2938c4e596fc3e3d099048f869e Mon Sep 17 00:00:00 2001 From: XeonSquared Date: Mon, 4 Nov 2019 11:45:47 +1100 Subject: [PATCH] fixed vt100 to actually use strings for control --- module/vt100.lua | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/module/vt100.lua b/module/vt100.lua index 9285503..b7ef1a8 100644 --- a/module/vt100.lua +++ b/module/vt100.lua @@ -48,10 +48,8 @@ function vt100emu(gpu) -- takes GPU component proxy *gpu* and returns a function mode = "n" end - elseif mode == "v" then -- save cursor - local n = cs:sub(cs:len(),cs:len()) - if n == "" then n = "\1" end - if cc == "s" then + elseif mode == "v" then + if cc == "s" then -- save cursor sx, sy = cx, cy mode = "n" elseif cc == "u" then -- restore cursor @@ -63,16 +61,16 @@ function vt100emu(gpu) -- takes GPU component proxy *gpu* and returns a function cx, cy = tonumber(tx), tonumber(ty) mode = "n" elseif cc == "A" then -- cursor up - cy = cy - string.byte(n) + cy = cy - tonumber(cs) or 1 mode = "n" elseif cc == "B" then -- cursor down - cy = cy + string.byte(n) + cy = cy + tonumber(cs) or 1 mode = "n" elseif cc == "C" then -- cursor right - cx = cx + string.byte(n) + cx = cx + tonumber(cs) or 1 mode = "n" elseif cc == "D" then -- cursor left - cx = cx - string.byte(n) + cx = cx - tonumber(cs) or 1 mode = "n" elseif cc == "h" and lc == "7" then -- enable line wrap lw = true