mirror of
https://github.com/MightyPirates/OpenComputers.git
synced 2025-09-17 03:05:30 -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
|
stdoutStream.close = stdinStream.close
|
||||||
stderrStream.close = stdinStream.close
|
stderrStream.close = stdinStream.close
|
||||||
|
|
||||||
function stdinStream:read(n)
|
function stdinStream:read(n, dowrap)
|
||||||
local result = term.read(stdinHistory)
|
local result = term.read(stdinHistory, dowrap)
|
||||||
while #stdinHistory > 10 do
|
while #stdinHistory > 10 do
|
||||||
table.remove(stdinHistory, 1)
|
table.remove(stdinHistory, 1)
|
||||||
end
|
end
|
||||||
@ -61,4 +61,4 @@ io.stdout:setvbuf("no")
|
|||||||
io.stderr:setvbuf("no")
|
io.stderr:setvbuf("no")
|
||||||
|
|
||||||
io.input(io.stdin)
|
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")
|
return component.isAvailable("gpu") and component.isAvailable("screen")
|
||||||
end
|
end
|
||||||
|
|
||||||
function term.read(history)
|
function term.read(history, dobreak)
|
||||||
checkArg(1, history, "table", "nil")
|
checkArg(1, history, "table", "nil")
|
||||||
history = history or {}
|
history = history or {}
|
||||||
table.insert(history, "")
|
table.insert(history, "")
|
||||||
@ -286,7 +286,7 @@ function term.read(history)
|
|||||||
table.remove(history)
|
table.remove(history)
|
||||||
end
|
end
|
||||||
term.setCursorBlink(false)
|
term.setCursorBlink(false)
|
||||||
if term.getCursor() > 1 then
|
if term.getCursor() > 1 and dobreak ~= false then
|
||||||
print()
|
print()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user