mirror of
https://github.com/MightyPirates/OpenComputers.git
synced 2025-09-16 18:55:03 -04:00
Make io.read() support support not breaking
If false is passed as second param to io.read() it now will not perform a line break after hitting return
This commit is contained in:
parent
cd2c5b5977
commit
d8ee287c96
@ -21,8 +21,8 @@ end
|
||||
stdoutStream.close = stdinStream.close
|
||||
stderrStream.close = stdinStream.close
|
||||
|
||||
function stdinStream:read(n)
|
||||
local result = term.read(stdinHistory)
|
||||
function stdinStream:read(n, dowrap)
|
||||
local result = term.read(stdinHistory, dowrap)
|
||||
while #stdinHistory > 10 do
|
||||
table.remove(stdinHistory, 1)
|
||||
end
|
||||
@ -61,4 +61,4 @@ io.stdout:setvbuf("no")
|
||||
io.stderr:setvbuf("no")
|
||||
|
||||
io.input(io.stdin)
|
||||
io.output(io.stdout)
|
||||
io.output(io.stdout)
|
||||
|
@ -80,7 +80,7 @@ function term.isAvailable()
|
||||
return component.isAvailable("gpu") and component.isAvailable("screen")
|
||||
end
|
||||
|
||||
function term.read(history)
|
||||
function term.read(history, dobreak)
|
||||
checkArg(1, history, "table", "nil")
|
||||
history = history or {}
|
||||
table.insert(history, "")
|
||||
@ -286,7 +286,7 @@ function term.read(history)
|
||||
table.remove(history)
|
||||
end
|
||||
term.setCursorBlink(false)
|
||||
if term.getCursor() > 1 then
|
||||
if term.getCursor() > 1 and dobreak ~= false then
|
||||
print()
|
||||
end
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user