Skip to content

Commit

Permalink
fix(commandline): don't trigger hover/exec functions if commandline i…
Browse files Browse the repository at this point in the history
…s closing
  • Loading branch information
Miodec committed Oct 15, 2024
1 parent a7664d4 commit 4f541da
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions frontend/src/ts/commandline/commandline.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ let inputModeParams: InputModeParams = {
icon: "",
};
let subgroupOverride: CommandsSubgroup | null = null;
let isAnimating = false;

function removeCommandlineBackground(): void {
$("#commandLine").addClass("noBackground");
Expand Down Expand Up @@ -123,6 +124,7 @@ function hide(clearModalChain = false): void {
if (ActivePage.get() === "test") {
focusWords();
}
isAnimating = true;
void modal.hide({
clearModalChain,
afterAnimation: async () => {
Expand All @@ -131,6 +133,7 @@ function hide(clearModalChain = false): void {
if (ActivePage.get() === "test" && !isWordsFocused) {
focusWords();
}
isAnimating = false;
},
});
}
Expand Down Expand Up @@ -433,6 +436,9 @@ async function showCommands(): Promise<void> {
}

async function updateActiveCommand(): Promise<void> {
console.log("updating active command");
if (isAnimating) return;

const elements = [
...document.querySelectorAll("#commandLine .suggestions .command"),
];
Expand Down Expand Up @@ -465,6 +471,7 @@ async function updateActiveCommand(): Promise<void> {
}

function handleInputSubmit(): void {
if (isAnimating) return;
if (inputModeParams.command === null) {
throw new Error("Can't handle input submit - command is null");
}
Expand All @@ -479,6 +486,8 @@ function handleInputSubmit(): void {
}

async function runActiveCommand(): Promise<void> {
console.log("running active command");
if (isAnimating) return;
if (activeCommand === null) return;
const command = activeCommand;
if (command.input) {
Expand Down

0 comments on commit 4f541da

Please sign in to comment.