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