TUI: coalesce multiline paste submits on macOS terminals

This commit is contained in:
Vignesh Natarajan
2026-02-21 19:19:55 -08:00
parent f2d664e24f
commit a10d689860
3 changed files with 37 additions and 3 deletions

View File

@@ -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;
}