From 7a44e6bb27bd49be193ff9f5e67eb5a5c031457e Mon Sep 17 00:00:00 2001 From: KaniPan <24561326+bluekani@users.noreply.github.com> Date: Sat, 12 Sep 2026 04:58:58 +0900 Subject: [PATCH] fix(terminal): fix Clear terminal hotkey action in PowerShell and Clink (#11405) Co-authored-by: Eugene --- tabby-terminal/src/api/baseTerminalTab.component.ts | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/tabby-terminal/src/api/baseTerminalTab.component.ts b/tabby-terminal/src/api/baseTerminalTab.component.ts index 7d3e377d..8e55f02b 100644 --- a/tabby-terminal/src/api/baseTerminalTab.component.ts +++ b/tabby-terminal/src/api/baseTerminalTab.component.ts @@ -257,7 +257,18 @@ export class BaseTerminalTabComponent

extends Bas this.frontend?.selectAll() break case 'clear': - this.forEachFocusedTerminalPane(tab => tab.frontend?.clear()) + this.forEachFocusedTerminalPane(tab => { + const tabProfile = tab.profile + const shellType: string = tabProfile.options?.shellType ?? '' + const shellArgs: string[] = tabProfile.options?.args ?? [] + if (this.hostApp.platform === Platform.Windows && (shellType === 'powershell' || shellArgs.some(arg => arg.includes('clink')))) { + // Windows PowerShell and cmd(Clink): send Ctrl+L to PTY (natively clears) + tab.sendInput('\x0c') + } else { + // Windows cmd(stock) and macOS/Linux: clear xterm buffer only + tab.frontend?.clear() + } + }) break case 'zoom-in': this.forEachFocusedTerminalPane(tab => tab.zoomIn())