mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-12-19 20:55:44 +01:00
TERMINAL: Fix autocompletion when running scripts with the "./" command (#900)
This commit is contained in:
parent
6f67224146
commit
87e2f5c23b
@ -277,12 +277,18 @@ export async function getTabCompletionPossibilities(terminalText: string, baseDi
|
||||
return possibilities;
|
||||
|
||||
default:
|
||||
if (!onCommand) {
|
||||
const options = await scriptAutocomplete();
|
||||
if (options) {
|
||||
addGeneric({ iterable: options, usePathing: false });
|
||||
}
|
||||
}
|
||||
return possibilities;
|
||||
}
|
||||
|
||||
async function scriptAutocomplete(): Promise<string[] | undefined> {
|
||||
let inputCopy = commandArray.join(" ");
|
||||
if (commandLength === 1) inputCopy = "run " + inputCopy;
|
||||
if (commandLength >= 1 && commandArray[0] !== "run") inputCopy = "run " + inputCopy;
|
||||
const commands = parseCommands(inputCopy);
|
||||
if (commands.length === 0) return;
|
||||
const command = parseCommand(commands[commands.length - 1]);
|
||||
|
@ -233,6 +233,9 @@ export function TerminalInput(): React.ReactElement {
|
||||
|
||||
// Autocomplete
|
||||
if (event.key === KEY.TAB) {
|
||||
if (event.altKey || event.ctrlKey) {
|
||||
return;
|
||||
}
|
||||
event.preventDefault();
|
||||
if (searchResults.length) {
|
||||
saveValue(searchResults[searchResultsIndex]);
|
||||
|
Loading…
Reference in New Issue
Block a user