1
1
mirror of https://git.shadowkat.net/izaya/OC-PsychOS2.git synced 2024-11-22 03:54:20 -05:00

remove debugging syslog calls from buffer library, reduce draw calls for readline

This commit is contained in:
XeonSquared 2020-06-11 13:20:49 +10:00
parent f95124996c
commit b4db6c7226

View File

@ -263,15 +263,17 @@ function buffer:read(...)
local function redraw() local function redraw()
io.write("\27[u") io.write("\27[u")
io.write(buffer.." ") io.write(buffer.." ")
io.write("\27[u") if pos < 1 then
io.write(buffer:sub(1,(#buffer-pos)+1)) io.write("\28[D")
else
io.write("\27[u")
io.write(buffer:sub(1,(#buffer-pos)+1))
end
end end
while true do while true do
syslog("top of readline loop")
char = readBytesOrChars(1) char = readBytesOrChars(1)
if char == "\27" then if char == "\27" then
if readBytesOrChars(1) == "[" then if readBytesOrChars(1) == "[" then
syslog("escape code")
local args = {""} local args = {""}
repeat repeat
char = readBytesOrChars(1) char = readBytesOrChars(1)
@ -286,12 +288,10 @@ function buffer:read(...)
until not char:match("[%d;]") until not char:match("[%d;]")
if char == "C" then -- right if char == "C" then -- right
if pos > 1 then if pos > 1 then
syslog("moving right")
pos = pos - 1 pos = pos - 1
end end
elseif char == "D" then -- left elseif char == "D" then -- left
if pos <= #buffer then if pos <= #buffer then
syslog("moving left")
pos = pos + 1 pos = pos + 1
end end
end end
@ -305,7 +305,6 @@ function buffer:read(...)
if chop then buffer = buffer .. "\n" end if chop then buffer = buffer .. "\n" end
return buffer return buffer
else else
syslog("char: "..tostring(string.byte(char)))
buffer = buffer:sub(1, (#buffer - pos) + 1) .. char .. buffer:sub((#buffer - pos) + 2) buffer = buffer:sub(1, (#buffer - pos) + 1) .. char .. buffer:sub((#buffer - pos) + 2)
end end
redraw() redraw()