fix(tui): harden terminal dimming and multiplexer copy#14906
Conversation
- disable ANSI dim on VTE terminals by default so dark-background reasoning and accents stay readable - suppress local multiplexer OSC52 echo while preserving remote passthrough and add regression coverage
There was a problem hiding this comment.
Pull request overview
Hardens TUI terminal compatibility by changing defaults for ANSI dim (on VTE terminals) and OSC52 clipboard emission (in local multiplexers), with environment-variable overrides and regression tests.
Changes:
- Add
shouldUseAnsiDim()and gatedimstyling to disable ANSI dim by default on VTE terminals (override viaHERMES_TUI_DIM). - Add
shouldEmitClipboardSequence()and suppress OSC52 clipboard sequences by default in local tmux/screen sessions (override viaHERMES_TUI_CLIPBOARD_OSC52/HERMES_TUI_COPY_OSC52), while keeping remote behavior. - Add Vitest coverage for both new compatibility decisions.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| ui-tui/packages/hermes-ink/src/ink/termio/osc.ts | Adds env-driven OSC52 emission decision and applies it to setClipboard(). |
| ui-tui/packages/hermes-ink/src/ink/termio/osc.test.ts | Adds tests for OSC52 emission decision defaults and overrides. |
| ui-tui/packages/hermes-ink/src/ink/components/Text.tsx | Adds env-driven ANSI dim decision and gates dim usage accordingly. |
| ui-tui/packages/hermes-ink/src/ink/components/Text.test.ts | Adds tests for ANSI dim decision defaults and override behavior. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| export function shouldEmitClipboardSequence(env: NodeJS.ProcessEnv = process.env): boolean { | ||
| const override = (env.HERMES_TUI_CLIPBOARD_OSC52 ?? env.HERMES_TUI_COPY_OSC52 ?? '').trim() | ||
|
|
There was a problem hiding this comment.
The parameter name env in shouldEmitClipboardSequence shadows the imported env helper from ../../utils/env.js used elsewhere in this module (e.g., osc()). This makes the code harder to read/grep and can lead to accidental misuse. Consider renaming the parameter to something like processEnv or envVars.
| return !!env['SSH_CONNECTION'] || (!env['TMUX'] && !env['STY']) | ||
| } |
There was a problem hiding this comment.
With the new default (!env['TMUX'] && !env['STY']), local GNU screen sessions (STY set, no SSH_CONNECTION) will suppress OSC52 emission, but getClipboardPath() still returns 'osc52' for screen because it only checks TMUX. That can make caller UX/toasts inaccurate and also removes the previous OSC52 fallback when no native clipboard tool is available. Consider updating getClipboardPath() to incorporate the new emission decision (or add a 'native-only'/'none' path when emission is suppressed).
…14906) - disable ANSI dim on VTE terminals by default so dark-background reasoning and accents stay readable - suppress local multiplexer OSC52 echo while preserving remote passthrough and add regression coverage
…14906) - disable ANSI dim on VTE terminals by default so dark-background reasoning and accents stay readable - suppress local multiplexer OSC52 echo while preserving remote passthrough and add regression coverage
…14906) - disable ANSI dim on VTE terminals by default so dark-background reasoning and accents stay readable - suppress local multiplexer OSC52 echo while preserving remote passthrough and add regression coverage
…14906) - disable ANSI dim on VTE terminals by default so dark-background reasoning and accents stay readable - suppress local multiplexer OSC52 echo while preserving remote passthrough and add regression coverage
…14906) - disable ANSI dim on VTE terminals by default so dark-background reasoning and accents stay readable - suppress local multiplexer OSC52 echo while preserving remote passthrough and add regression coverage
…14906) - disable ANSI dim on VTE terminals by default so dark-background reasoning and accents stay readable - suppress local multiplexer OSC52 echo while preserving remote passthrough and add regression coverage
…14906) - disable ANSI dim on VTE terminals by default so dark-background reasoning and accents stay readable - suppress local multiplexer OSC52 echo while preserving remote passthrough and add regression coverage
…14906) - disable ANSI dim on VTE terminals by default so dark-background reasoning and accents stay readable - suppress local multiplexer OSC52 echo while preserving remote passthrough and add regression coverage
Summary
Test plan
cd ui-tui && ./node_modules/.bin/vitest runcd ui-tui && ./node_modules/.bin/tsc --noEmit -p tsconfig.json(currently fails on pre-existingpackages/hermes-ink/src/ink/dom.tserror unrelated to this PR)