Skip to content

Commit 54b9220

Browse files
committed
fix: arrows funbox not working
1 parent e313555 commit 54b9220

File tree

2 files changed

+17
-5
lines changed

2 files changed

+17
-5
lines changed

frontend/src/ts/input/handlers/insert-text.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,10 @@ export async function onInsertText(options: OnInsertTextParams): Promise<void> {
135135
// is char correct
136136
const funboxCorrect = findSingleActiveFunboxWithFunction(
137137
"isCharCorrect"
138-
)?.functions.isCharCorrect(data, currentWord[inputValue.length] ?? "");
138+
)?.functions.isCharCorrect(
139+
data,
140+
currentWord[(testInput + data).length - 1] ?? ""
141+
);
139142
const correct =
140143
funboxCorrect ??
141144
isCharCorrect({

frontend/src/ts/test/funbox/funbox-functions.ts

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -257,25 +257,34 @@ const list: Partial<Record<FunboxName, FunboxFunctions>> = {
257257
},
258258
isCharCorrect(char: string, originalChar: string): boolean {
259259
if (
260-
(char === "a" || char === "ArrowLeft" || char === "j") &&
260+
(char === "a" ||
261+
char === "ArrowLeft" ||
262+
char === "j" ||
263+
char === "←") &&
261264
originalChar === "←"
262265
) {
263266
return true;
264267
}
265268
if (
266-
(char === "s" || char === "ArrowDown" || char === "k") &&
269+
(char === "s" ||
270+
char === "ArrowDown" ||
271+
char === "k" ||
272+
char === "↓") &&
267273
originalChar === "↓"
268274
) {
269275
return true;
270276
}
271277
if (
272-
(char === "w" || char === "ArrowUp" || char === "i") &&
278+
(char === "w" || char === "ArrowUp" || char === "i" || char === "↑") &&
273279
originalChar === "↑"
274280
) {
275281
return true;
276282
}
277283
if (
278-
(char === "d" || char === "ArrowRight" || char === "l") &&
284+
(char === "d" ||
285+
char === "ArrowRight" ||
286+
char === "l" ||
287+
char === "→") &&
279288
originalChar === "→"
280289
) {
281290
return true;

0 commit comments

Comments
 (0)