From 8c001bd1aec044cb0fa66a840dcdb941fc638be3 Mon Sep 17 00:00:00 2001 From: nickofolas Date: Mon, 10 Jan 2022 16:32:50 -0600 Subject: [PATCH] Allow autocomplete for partial executables --- src/Terminal/determineAllPossibilitiesForTabCompletion.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Terminal/determineAllPossibilitiesForTabCompletion.ts b/src/Terminal/determineAllPossibilitiesForTabCompletion.ts index e765f1757..f50960b26 100644 --- a/src/Terminal/determineAllPossibilitiesForTabCompletion.ts +++ b/src/Terminal/determineAllPossibilitiesForTabCompletion.ts @@ -183,7 +183,7 @@ export async function determineAllPossibilitiesForTabCompletion( * has input ./partialexecutablename so autocomplete the script or program. * Put './' in front of each script/executable */ - if (isCommand("./") && index == -1) { + if (input.startsWith("./") && index == -1) { //All programs and scripts for (let i = 0; i < currServ.scripts.length; ++i) { allPos.push("./" + currServ.scripts[i].filename); @@ -286,7 +286,8 @@ export async function determineAllPossibilitiesForTabCompletion( } async function scriptAutocomplete(): Promise { - if (!isCommand("run") && !isCommand("tail") && !isCommand("kill")) return; + if (!isCommand("run") && !isCommand("tail") && !isCommand("kill") && !input.startsWith("./")) return; + if (input.startsWith("./")) input = "run " + input.slice(2); const commands = ParseCommands(input); if (commands.length === 0) return; const command = ParseCommand(commands[commands.length - 1]);