Browse Source

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

master
Izaya 3 years ago
parent
commit
b4db6c7226
  1. 13
      module/buffer.lua

13
module/buffer.lua

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

Loading…
Cancel
Save