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
4 changes: 4 additions & 0 deletions frontend/src/ts/event-handlers/global.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { focusWords } from "../test/test-ui";
import * as TestLogic from "../test/test-logic";
import { navigate } from "../controllers/route-controller";
import { isInputElementFocused } from "../input/input-element";
import * as ManualRestart from "../test/manual-restart-tracker";

document.addEventListener("keydown", (e) => {
if (PageTransition.get()) return;
Expand Down Expand Up @@ -74,6 +75,9 @@ document.addEventListener("keydown", (e) => {
) {
e.preventDefault();
if (ActivePage.get() === "test") {
if (e.shiftKey) {
ManualRestart.set();
}
TestLogic.restart();
} else {
void navigate("");
Expand Down
12 changes: 12 additions & 0 deletions frontend/src/ts/input/handlers/keydown.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import * as Notifications from "../../elements/notifications";
import * as KeyConverter from "../../utils/key-converter";
import * as ShiftTracker from "../../test/shift-tracker";
import * as CompositionState from "../../states/composition";
import * as ManualRestart from "../../test/manual-restart-tracker";
import { canQuickRestart } from "../../utils/quick-restart";
import * as CustomText from "../../test/custom-text";
import * as CustomTextState from "../../states/custom-text-name";
Expand All @@ -28,6 +29,9 @@ export async function handleTab(e: KeyboardEvent, now: number): Promise<void> {
if (Config.quickRestart === "tab") {
e.preventDefault();
if ((TestWords.hasTab && e.shiftKey) || !TestWords.hasTab) {
if (e.shiftKey) {
ManualRestart.set();
}
TestLogic.restart();
return;
}
Expand Down Expand Up @@ -81,6 +85,9 @@ export async function handleEnter(
if (Config.quickRestart === "enter") {
e.preventDefault();
if ((TestWords.hasNewline && e.shiftKey) || !TestWords.hasNewline) {
if (e.shiftKey) {
ManualRestart.set();
}
TestLogic.restart();
return;
}
Expand Down Expand Up @@ -206,6 +213,11 @@ export async function onKeydown(event: KeyboardEvent): Promise<void> {

if (event.key === "Escape" && Config.quickRestart === "esc") {
event.preventDefault();

if (event.shiftKey) {
ManualRestart.set();
}

TestLogic.restart();
return;
}
Expand Down