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 {