Skip to content

Commit f5f613b

Browse files
committed
block removing words at the first call of scrollTape()
1 parent 67584e3 commit f5f613b

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
@@ -588,7 +588,7 @@ export function updateWordsWrapperHeight(force = false): void {
588588

589589
function updateWordsMargin(): void {
590590
if (Config.tapeMode !== "off") {
591-
void scrollTape();
591+
void scrollTape(true);
592592
} else {
593593
const wordsEl = document.getElementById("words") as HTMLElement;
594594
const afterNewlineEls =
@@ -826,7 +826,7 @@ function getNlCharWidth(
826826
return nlChar.offsetWidth + letterMargin;
827827
}
828828

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

832832
await centeringActiveLine;
@@ -950,7 +950,7 @@ export async function scrollTape(): Promise<void> {
950950
}
951951

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

0 commit comments

Comments
 (0)