From d8ee287c964e4b9f50fff97b624e0c88bb8d92a0 Mon Sep 17 00:00:00 2001 From: Kilobyte22 Date: Sun, 6 Jul 2014 18:05:16 +0200 Subject: [PATCH] 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 --- .../assets/opencomputers/loot/OpenOS/boot/02_io.lua | 6 +++--- .../resources/assets/opencomputers/loot/OpenOS/lib/term.lua | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/resources/assets/opencomputers/loot/OpenOS/boot/02_io.lua b/src/main/resources/assets/opencomputers/loot/OpenOS/boot/02_io.lua index edcf4dce2..45c2ed946 100644 --- a/src/main/resources/assets/opencomputers/loot/OpenOS/boot/02_io.lua +++ b/src/main/resources/assets/opencomputers/loot/OpenOS/boot/02_io.lua @@ -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) \ No newline at end of file +io.output(io.stdout) diff --git a/src/main/resources/assets/opencomputers/loot/OpenOS/lib/term.lua b/src/main/resources/assets/opencomputers/loot/OpenOS/lib/term.lua index a6d239277..fa60b795b 100644 --- a/src/main/resources/assets/opencomputers/loot/OpenOS/lib/term.lua +++ b/src/main/resources/assets/opencomputers/loot/OpenOS/lib/term.lua @@ -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