Conversation
There was a problem hiding this comment.
Pull request overview
Adjusts frontend hotkey resolution to avoid conflicts between “quick restart” / “commandline” and test content (tabs/newlines), by dynamically shifting certain hotkeys on the test page.
Changes:
- Shift
quickRestartonly when its configured key conflicts with test content (tabs/newlines) or in long tests. - Shift
commandlinetoShift+Tabwhen it would otherwise block typing literal tabs. - Refactor conditions into named booleans for readability.
frontend/src/ts/states/hotkeys.ts
Outdated
| isOnTestPage && (wordsHaveTab() || isLongTest()), | ||
| isOnTestPage && | ||
| ((wordsHaveTab() && quickRestartIsTab) || | ||
| (wordsHaveNewline() && quickRestartIsEnter) || |
There was a problem hiding this comment.
quickRestart=enter is shifted only when wordsHaveNewline(), but funbox "58008" uses Enter for input (see funbox-functions getEmulatedChar) and modes-notice already treats it like newline. Missing this here means Enter can still trigger quick restart while user is typing in that funbox; include getConfig.funbox.includes("58008") in the shift condition for quickRestart when quickRestartIsEnter.
| (wordsHaveNewline() && quickRestartIsEnter) || | |
| ((wordsHaveNewline() || getConfig.funbox.includes("58008")) && | |
| quickRestartIsEnter) || |
| // const quickRestartIsEsc = getConfig.quickRestart === "esc"; | ||
|
|
||
| const commandlineIsTab = getConfig.quickRestart === "esc"; | ||
| // const commandlineIsEsc = getConfig.quickRestart !== "esc"; |
There was a problem hiding this comment.
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).
| // const quickRestartIsEsc = getConfig.quickRestart === "esc"; | |
| const commandlineIsTab = getConfig.quickRestart === "esc"; | |
| // const commandlineIsEsc = getConfig.quickRestart !== "esc"; | |
| const commandlineIsTab = getConfig.quickRestart === "esc"; |
No description provided.