Skip to content

Commit 148fa1e

Browse files
committed
refactor: move tape scrolling function call to the ui file
1 parent 0e8274f commit 148fa1e

2 files changed

Lines changed: 3 additions & 13 deletions

File tree

frontend/src/ts/controllers/input-controller.ts

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1083,9 +1083,6 @@ $(document).on("keydown", async (event) => {
10831083
} else {
10841084
handleChar("\n", TestInput.input.current.length);
10851085
setWordsInput(" " + TestInput.input.current);
1086-
if (Config.tapeMode !== "off") {
1087-
TestUI.scrollTape();
1088-
}
10891086
}
10901087
}
10911088

@@ -1140,9 +1137,6 @@ $(document).on("keydown", async (event) => {
11401137
handleChar(event.key, TestInput.input.current.length);
11411138
updateUI();
11421139
setWordsInput(" " + TestInput.input.current);
1143-
if (Config.tapeMode !== "off") {
1144-
TestUI.scrollTape();
1145-
}
11461140
}
11471141
}
11481142

@@ -1160,9 +1154,6 @@ $(document).on("keydown", async (event) => {
11601154
updateUI();
11611155
setWordsInput(" " + TestInput.input.current);
11621156
}
1163-
if (Config.tapeMode !== "off") {
1164-
TestUI.scrollTape();
1165-
}
11661157
}
11671158

11681159
isBackspace = event.key === "Backspace" || event.key === "delete";
@@ -1377,10 +1368,6 @@ $("#wordsInput").on("input", (event) => {
13771368

13781369
setWordsInput(" " + TestInput.input.current);
13791370
updateUI();
1380-
if (Config.tapeMode !== "off") {
1381-
TestUI.scrollTape();
1382-
}
1383-
13841371
const statebefore = CompositionState.getComposing();
13851372
setTimeout(() => {
13861373
// checking composition state during the input event and on the next loop

frontend/src/ts/test/test-ui.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,9 @@ export function updateActiveElement(
252252
if (!initial && shouldUpdateWordsInputPosition()) {
253253
void updateWordsInputPosition();
254254
}
255+
if (Config.tapeMode !== "off") {
256+
scrollTape();
257+
}
255258
}
256259

257260
async function updateHintsPosition(): Promise<void> {

0 commit comments

Comments
 (0)