Change CTRL+C to clear the current line

This commit is contained in:
2025-10-12 22:17:02 +01:00
parent 8598e9ff57
commit 990aee8168

View File

@@ -49,7 +49,10 @@ local function detect_tty() return util.is_tty() end
local line local line
if raw_mode_enabled then if raw_mode_enabled then
line = raw_read_line(prompt) line = raw_read_line(prompt)
if line == "__CTRL_C__" then print("\nInterrupted (Ctrl+C)"); break end if line == "__CTRL_C__" then
io.write("\r\27[K")
goto continue
end
else else
io.write(prompt); io.flush() io.write(prompt); io.flush()
local ok, l = pcall(io.read, "*line") local ok, l = pcall(io.read, "*line")