From 4a78c33a09b268dd14508b75dbcbb282f1a3fea6 Mon Sep 17 00:00:00 2001 From: xochitlacosta55-web Date: Mon, 24 Nov 2025 18:35:37 +0000 Subject: [PATCH] =?UTF-8?q?A=C3=B1adir=20manejo=20de=20desplazamiento=20au?= =?UTF-8?q?tom=C3=A1tico=20en=20el=20terminal=20al=20escribir=20y=20mover?= =?UTF-8?q?=20el=20cursor?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Server/src/terminal/terminalAddon.ts | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/Server/src/terminal/terminalAddon.ts b/Server/src/terminal/terminalAddon.ts index bf78dfe5..37248f6f 100644 --- a/Server/src/terminal/terminalAddon.ts +++ b/Server/src/terminal/terminalAddon.ts @@ -222,6 +222,15 @@ export class TerminalAddon implements ITerminalAddon { } if (this.inputBuffer.length === this.cursor) { + try { + if (typeof (this.term as any).scrollToBottom === 'function') { + (this.term as any).scrollToBottom(); + } else if (typeof (this.term as any).scrollLines === 'function') { + (this.term as any).scrollLines(this.termSize.rows); + } + } catch (e) { + // ignore + } return; } @@ -233,6 +242,17 @@ export class TerminalAddon implements ITerminalAddon { if (cursorPosition.col > 0) { this.term.write(VT.CursorForward(cursorPosition.col)); } + + // Ensure the last line is visible after moving the cursor + try { + if (typeof (this.term as any).scrollToBottom === 'function') { + (this.term as any).scrollToBottom(); + } else if (typeof (this.term as any).scrollLines === 'function') { + (this.term as any).scrollLines(this.termSize.rows); + } + } catch (e) { + // ignore + } }; private calcCursorPosition(): TerminalPosition {