Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions frontend/src/ts/input/hotkeys/quickrestart.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { getActivePage } from "../../states/core";
import { hotkeys, quickRestartHotkeyMap } from "../../states/hotkeys";
import { createHotkey } from "./utils";
import { getConfig } from "../../config/store";
import { isLongTest } from "../../states/test";
import { isLongTest, wordsHaveNewline, wordsHaveTab } from "../../states/test";

function quickRestart(e: KeyboardEvent): void {
if (isAnyPopupVisible()) {
Expand Down Expand Up @@ -37,5 +37,10 @@ createHotkey(
createHotkey(
() => quickRestartHotkeyMap[getConfig.quickRestart],
quickRestart,
() => ({ enabled: isLongTest() }),
() => ({
enabled:
isLongTest() &&
!(wordsHaveTab() && getConfig.quickRestart === "tab") &&
!(wordsHaveNewline() && getConfig.quickRestart === "enter"),
}),
);
18 changes: 15 additions & 3 deletions frontend/src/ts/states/hotkeys.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,26 @@ createEffect(() => {

function updateHotkeys(): Hotkeys {
const isOnTestPage = getActivePage() === "test";

const quickRestartIsTab = getConfig.quickRestart === "tab";
const quickRestartIsEnter = getConfig.quickRestart === "enter";
// const quickRestartIsEsc = getConfig.quickRestart === "esc";

const commandlineIsTab = getConfig.quickRestart === "esc";
// const commandlineIsEsc = getConfig.quickRestart !== "esc";
Comment on lines +34 to +37
Copy link

Copilot AI Apr 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove the commented-out boolean helpers (quickRestartIsEsc/commandlineIsEsc) or use them; leaving commented code in this hotkey logic makes future edits/error-prone (esp since these flags are central to keybinding conflicts).

Suggested change
// const quickRestartIsEsc = getConfig.quickRestart === "esc";
const commandlineIsTab = getConfig.quickRestart === "esc";
// const commandlineIsEsc = getConfig.quickRestart !== "esc";
const commandlineIsTab = getConfig.quickRestart === "esc";

Copilot uses AI. Check for mistakes.

return {
quickRestart: shiftHotkey(
quickRestartHotkeyMap[getConfig.quickRestart],
isOnTestPage && (wordsHaveTab() || isLongTest()),
isOnTestPage &&
((wordsHaveTab() && quickRestartIsTab) ||
((wordsHaveNewline() || getConfig.funbox.includes("58008")) &&
quickRestartIsEnter) ||
isLongTest()),
),
commandline: shiftHotkey(
getConfig.quickRestart === "esc" ? "Tab" : "Escape",
isOnTestPage && wordsHaveNewline(),
commandlineIsTab ? "Tab" : "Escape",
isOnTestPage && wordsHaveTab() && commandlineIsTab,
),
};
}
Expand Down
Loading