diff --git a/src/util/console-color.ts b/src/util/console-color.ts index 605d976..eb4a19e 100644 --- a/src/util/console-color.ts +++ b/src/util/console-color.ts @@ -178,13 +178,14 @@ export class ColoredConsole { } } } + const atBottom = + this.targetElement.scrollTop > + this.targetElement.scrollHeight - this.targetElement.offsetHeight - 50; + addSpan(line.substring(i)); - if ( - this.targetElement.scrollTop + 56 >= - this.targetElement.scrollHeight - this.targetElement.offsetHeight - ) { - // at bottom + // Keep scroll at bottom + if (atBottom) { this.targetElement.scrollTop = this.targetElement.scrollHeight; } }