From c8f11d63b5f8b01f4bccbbf4d9bd25ef19e0dfad Mon Sep 17 00:00:00 2001 From: Daniel Imms <2193314+Tyriar@users.noreply.github.com> Date: Sat, 6 Jun 2026 09:43:22 -0700 Subject: [PATCH] fix(terminal): always run clear() at cursor home (#5992) Remove early return when ybase===0 && y===0 so clear() always clears markers, resets buffer lines, and refills the viewport. Co-authored-by: Cursor Agent Co-authored-by: Daniel Imms --- src/browser/CoreBrowserTerminal.ts | 4 ---- src/headless/Terminal.ts | 4 ---- 2 files changed, 8 deletions(-) diff --git a/src/browser/CoreBrowserTerminal.ts b/src/browser/CoreBrowserTerminal.ts index 2b024e72e..4557e1652 100644 --- a/src/browser/CoreBrowserTerminal.ts +++ b/src/browser/CoreBrowserTerminal.ts @@ -1072,10 +1072,6 @@ export class CoreBrowserTerminal extends CoreTerminal implements ITerminal { * Clear the entire buffer, making the prompt line the new first line. */ public clear(): void { - if (this.buffer.ybase === 0 && this.buffer.y === 0) { - // Don't clear if it's already clear - return; - } this.buffer.clearAllMarkers(); this.buffer.lines.set(0, this.buffer.lines.get(this.buffer.ybase + this.buffer.y)!); this.buffer.lines.length = 1; diff --git a/src/headless/Terminal.ts b/src/headless/Terminal.ts index 4d90cc03e..16dc932be 100644 --- a/src/headless/Terminal.ts +++ b/src/headless/Terminal.ts @@ -99,10 +99,6 @@ export class Terminal extends CoreTerminal { * Clear the entire buffer, making the prompt line the new first line. */ public clear(): void { - if (this.buffer.ybase === 0 && this.buffer.y === 0) { - // Don't clear if it's already clear - return; - } this.buffer.clearAllMarkers(); this.buffer.lines.set(0, this.buffer.lines.get(this.buffer.ybase + this.buffer.y)!); this.buffer.lines.length = 1;