Skip to content

Commit 4f541da

Browse files
committed
fix(commandline): don't trigger hover/exec functions if commandline is closing
1 parent a7664d4 commit 4f541da

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

frontend/src/ts/commandline/commandline.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ let inputModeParams: InputModeParams = {
3333
icon: "",
3434
};
3535
let subgroupOverride: CommandsSubgroup | null = null;
36+
let isAnimating = false;
3637

3738
function removeCommandlineBackground(): void {
3839
$("#commandLine").addClass("noBackground");
@@ -123,6 +124,7 @@ function hide(clearModalChain = false): void {
123124
if (ActivePage.get() === "test") {
124125
focusWords();
125126
}
127+
isAnimating = true;
126128
void modal.hide({
127129
clearModalChain,
128130
afterAnimation: async () => {
@@ -131,6 +133,7 @@ function hide(clearModalChain = false): void {
131133
if (ActivePage.get() === "test" && !isWordsFocused) {
132134
focusWords();
133135
}
136+
isAnimating = false;
134137
},
135138
});
136139
}
@@ -433,6 +436,9 @@ async function showCommands(): Promise<void> {
433436
}
434437

435438
async function updateActiveCommand(): Promise<void> {
439+
console.log("updating active command");
440+
if (isAnimating) return;
441+
436442
const elements = [
437443
...document.querySelectorAll("#commandLine .suggestions .command"),
438444
];
@@ -465,6 +471,7 @@ async function updateActiveCommand(): Promise<void> {
465471
}
466472

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

481488
async function runActiveCommand(): Promise<void> {
489+
console.log("running active command");
490+
if (isAnimating) return;
482491
if (activeCommand === null) return;
483492
const command = activeCommand;
484493
if (command.input) {

0 commit comments

Comments
 (0)