^C now terminates line mode input with an error

This commit is contained in:
Izaya 2023-06-07 00:12:50 +10:00
parent ddc2445104
commit a533748d55

View File

@ -307,6 +307,8 @@ function buffer:read(...)
if #buffer > 0 and pos <= #buffer then if #buffer > 0 and pos <= #buffer then
buffer = buffer:sub(1, (#buffer - pos)) .. buffer:sub((#buffer - pos) + 2) buffer = buffer:sub(1, (#buffer - pos)) .. buffer:sub((#buffer - pos) + 2)
end end
elseif char == "\3" then -- ^C, error
error("terminated")
elseif char == "\1" then -- ^A, go to start of line elseif char == "\1" then -- ^A, go to start of line
pos = buffer:len()+1 pos = buffer:len()+1
elseif char == "\5" then -- ^E, go to end of line elseif char == "\5" then -- ^E, go to end of line