From a10d6898602c84b8071e64d257c658b309c14e87 Mon Sep 17 00:00:00 2001 From: Vignesh Natarajan Date: Sat, 21 Feb 2026 19:19:55 -0800 Subject: [PATCH] TUI: coalesce multiline paste submits on macOS terminals --- CHANGELOG.md | 1 + src/tui/tui.submit-handler.test.ts | 24 +++++++++++++++++++++++- src/tui/tui.ts | 15 +++++++++++++-- 3 files changed, 37 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e43f5a355c4..f76e1fbb430 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,6 +20,7 @@ Docs: https://docs.openclaw.ai - Agents/Ollama: preserve unsafe integer tool-call arguments as exact strings during NDJSON parsing, preventing large numeric IDs from being rounded before tool execution. (#23170) Thanks @BestJoester. - Cron/Gateway: keep `cron.list` and `cron.status` responsive during startup catch-up by avoiding a long-held cron lock while missed jobs execute. (#23106) Thanks @jayleekr. - Gateway/Config reload: compare array-valued config paths structurally during diffing so unchanged `memory.qmd.paths` and `memory.qmd.scope.rules` no longer trigger false restart-required reloads. (#23185) Thanks @rex05ai. +- TUI/Input: enable multiline-paste burst coalescing on macOS Terminal.app and iTerm so pasted blocks no longer submit line-by-line as separate messages. (#18809) Thanks @fwends. - Gateway/Pairing: treat operator.admin pairing tokens as satisfying operator.write requests so legacy devices stop looping through scope-upgrade prompts introduced in 2026.2.19. (#23125, #23006) Thanks @vignesh07. - Memory/QMD: add optional `memory.qmd.mcporter` search routing so QMD `query/search/vsearch` can run through mcporter keep-alive flows (including multi-collection paths) to reduce cold starts, while keeping searches on agent-scoped QMD state for consistent recall. (#19617) Thanks @nicole-luxe and @vignesh07. - Chat/UI: strip inline reply/audio directive tags (`[[reply_to_current]]`, `[[reply_to:]]`, `[[audio_as_voice]]`) from displayed chat history, live chat event output, and session preview snippets so control tags no longer leak into user-visible surfaces. diff --git a/src/tui/tui.submit-handler.test.ts b/src/tui/tui.submit-handler.test.ts index dc337ad294e..64743ce070d 100644 --- a/src/tui/tui.submit-handler.test.ts +++ b/src/tui/tui.submit-handler.test.ts @@ -130,10 +130,32 @@ describe("shouldEnableWindowsGitBashPasteFallback", () => { ).toBe(true); }); - it("disables fallback outside Windows", () => { + it("enables fallback on macOS iTerm", () => { expect( shouldEnableWindowsGitBashPasteFallback({ platform: "darwin", + env: { + TERM_PROGRAM: "iTerm.app", + } as NodeJS.ProcessEnv, + }), + ).toBe(true); + }); + + it("enables fallback on macOS Terminal.app", () => { + expect( + shouldEnableWindowsGitBashPasteFallback({ + platform: "darwin", + env: { + TERM_PROGRAM: "Apple_Terminal", + } as NodeJS.ProcessEnv, + }), + ).toBe(true); + }); + + it("disables fallback outside Windows", () => { + expect( + shouldEnableWindowsGitBashPasteFallback({ + platform: "linux", env: { MSYSTEM: "MINGW64", } as NodeJS.ProcessEnv, diff --git a/src/tui/tui.ts b/src/tui/tui.ts index 580876242ab..33c3287ccf4 100644 --- a/src/tui/tui.ts +++ b/src/tui/tui.ts @@ -84,13 +84,24 @@ export function shouldEnableWindowsGitBashPasteFallback(params?: { env?: NodeJS.ProcessEnv; }): boolean { const platform = params?.platform ?? process.platform; + const env = params?.env ?? process.env; + const termProgram = (env.TERM_PROGRAM ?? "").toLowerCase(); + + // Some macOS terminals emit multiline paste as rapid single-line submits. + // Enable burst coalescing so pasted blocks stay as one user message. + if (platform === "darwin") { + if (termProgram.includes("iterm") || termProgram.includes("apple_terminal")) { + return true; + } + return false; + } + if (platform !== "win32") { return false; } - const env = params?.env ?? process.env; + const msystem = (env.MSYSTEM ?? "").toUpperCase(); const shell = env.SHELL ?? ""; - const termProgram = (env.TERM_PROGRAM ?? "").toLowerCase(); if (msystem.startsWith("MINGW") || msystem.startsWith("MSYS")) { return true; }