From b7d6c950cf3712664ee076a329457fd163dcc275 Mon Sep 17 00:00:00 2001 From: Butterfly Dev Date: Tue, 7 Apr 2026 04:00:51 +0000 Subject: [PATCH] fix: terminal now auto-scrolls on output (was missing AfterViewChecked) --- .../app/components/apps/terminal/terminal.component.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/desktop/src/app/components/apps/terminal/terminal.component.ts b/desktop/src/app/components/apps/terminal/terminal.component.ts index db52354..2b471fe 100644 --- a/desktop/src/app/components/apps/terminal/terminal.component.ts +++ b/desktop/src/app/components/apps/terminal/terminal.component.ts @@ -1,4 +1,4 @@ -import { Component, ElementRef, ViewChild, AfterViewInit, signal } from '@angular/core'; +import { Component, ElementRef, ViewChild, AfterViewInit, AfterViewChecked, signal } from '@angular/core'; import { CommonModule } from '@angular/common'; @Component({ @@ -8,7 +8,7 @@ import { CommonModule } from '@angular/common'; templateUrl: './terminal.component.html', styleUrl: './terminal.component.scss', }) -export class TerminalComponent implements AfterViewInit { +export class TerminalComponent implements AfterViewInit, AfterViewChecked { @ViewChild('terminalBody') terminalBody!: ElementRef; @ViewChild('termInput') termInput!: ElementRef; @@ -96,6 +96,11 @@ export class TerminalComponent implements AfterViewInit { this.lines.update((l) => [...l, text]); } + /** Auto-scroll to bottom whenever the view updates. */ + ngAfterViewChecked(): void { + this.scrollToBottom(); + } + /** Focus the input when the terminal is clicked. */ onClick(): void { this.termInput?.nativeElement.focus();