fixed vt100 to actually use strings for control

This commit is contained in:
Izaya 2019-11-04 11:45:47 +11:00
parent 0ced41b897
commit 578a9e966f

View File

@ -48,10 +48,8 @@ function vt100emu(gpu) -- takes GPU component proxy *gpu* and returns a function
mode = "n" mode = "n"
end end
elseif mode == "v" then -- save cursor elseif mode == "v" then
local n = cs:sub(cs:len(),cs:len()) if cc == "s" then -- save cursor
if n == "" then n = "\1" end
if cc == "s" then
sx, sy = cx, cy sx, sy = cx, cy
mode = "n" mode = "n"
elseif cc == "u" then -- restore cursor 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) cx, cy = tonumber(tx), tonumber(ty)
mode = "n" mode = "n"
elseif cc == "A" then -- cursor up elseif cc == "A" then -- cursor up
cy = cy - string.byte(n) cy = cy - tonumber(cs) or 1
mode = "n" mode = "n"
elseif cc == "B" then -- cursor down elseif cc == "B" then -- cursor down
cy = cy + string.byte(n) cy = cy + tonumber(cs) or 1
mode = "n" mode = "n"
elseif cc == "C" then -- cursor right elseif cc == "C" then -- cursor right
cx = cx + string.byte(n) cx = cx + tonumber(cs) or 1
mode = "n" mode = "n"
elseif cc == "D" then -- cursor left elseif cc == "D" then -- cursor left
cx = cx - string.byte(n) cx = cx - tonumber(cs) or 1
mode = "n" mode = "n"
elseif cc == "h" and lc == "7" then -- enable line wrap elseif cc == "h" and lc == "7" then -- enable line wrap
lw = true lw = true