From 9c6bbbef757ca74c8e181a2a9dcec22e29f77b2e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Thu, 7 Aug 2014 17:16:03 +0200 Subject: [PATCH] Update shell to work with new term.lua --- .../assets/opencomputers/loot/OpenOS/bin/sh.lua | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/main/resources/assets/opencomputers/loot/OpenOS/bin/sh.lua b/src/main/resources/assets/opencomputers/loot/OpenOS/bin/sh.lua index fef601950..2bab3714c 100644 --- a/src/main/resources/assets/opencomputers/loot/OpenOS/bin/sh.lua +++ b/src/main/resources/assets/opencomputers/loot/OpenOS/bin/sh.lua @@ -207,12 +207,13 @@ local function hintHandler(line) if lastSearch == line then return matches end else local matches = getMatchingFiles(after) - if #matches == 1 then - lastSearch = "" - local ret = base .. space .. after .. matches[1]:gsub(after:match("[/]*(%w+)$"),"",1) - return ret:gsub("[^/]$","%1 ") + + for k in ipairs(matches)do + local ret = base .. space .. after .. (matches[k]):gsub(after:match("[/]*(%w+)$") or "","",1) + matches[k] = ret:gsub("[^/]$","%1 "):gsub("/$","") end - if lastSearch == line then return matches end + + return matches end lastSearch = line end @@ -227,7 +228,8 @@ if #args == 0 and (io.input() == io.stdin or options.i) and not options.c then term.clear() end while term.isAvailable() do - local command = term.read(history, nil, hintHandler, drawPrompt) + drawPrompt() + local command = term.read(history, nil, hintHandler) if not command then term.write("exit\n") return -- eof