Skip to content

Commit 9dd7484

Browse files
committed
block removing words at the first call of scrollTape()
1 parent 8573ee8 commit 9dd7484

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -584,7 +584,7 @@ export function updateWordsWrapperHeight(force = false): void {
584584

585585
function updateWordsMargin(): void {
586586
if (Config.tapeMode !== "off") {
587-
void scrollTape();
587+
void scrollTape(true);
588588
} else {
589589
const wordsEl = document.getElementById("words") as HTMLElement;
590590
const afterNewlineEls =
@@ -822,7 +822,7 @@ function getNlCharWidth(
822822
return nlChar.offsetWidth + letterMargin;
823823
}
824824

825-
export async function scrollTape(): Promise<void> {
825+
export async function scrollTape(noRemove = false): Promise<void> {
826826
if (ActivePage.get() !== "test" || resultVisible) return;
827827

828828
await centeringActiveLine;
@@ -946,7 +946,7 @@ export async function scrollTape(): Promise<void> {
946946
}
947947

948948
/* remove overflown elements */
949-
if (toRemove.length > 0) {
949+
if (toRemove.length > 0 && !noRemove) {
950950
activeWordElementOffset += wordsToRemoveCount;
951951
for (const el of toRemove) el.remove();
952952
for (let i = 0; i < widthRemovedFromLine.length; i++) {

0 commit comments

Comments
 (0)