Skip to content

fix(terminal): add OSC 66 compatibility for older terminals#605

Merged
kommander merged 3 commits intoanomalyco:mainfrom
jobrk:fix/osc66-terminal-compatibility
Feb 2, 2026
Merged

fix(terminal): add OSC 66 compatibility for older terminals#605
kommander merged 3 commits intoanomalyco:mainfrom
jobrk:fix/osc66-terminal-compatibility

Conversation

@jobrk
Copy link
Contributor

@jobrk jobrk commented Jan 31, 2026

Fixes compatibility issues with older terminal emulators (e.g., GNOME Terminal) that don't support OSC 66 escape sequences. These terminals were displaying visible artifacts containing "66" when OpenTUI applications ran.

Changes:

  • Enhanced OPENTUI_FORCE_EXPLICIT_WIDTH environment variable to skip OSC 66 queries when set to "false" or "0"
  • Added skip_explicit_width_query flag to Terminal struct
  • Modified queryTerminalSend() to conditionally skip OSC 66 queries
  • Added comprehensive tests for the new behavior
  • Updated environment variable documentation
  • Added Terminal Compatibility section to development.md

When OPENTUI_FORCE_EXPLICIT_WIDTH=false:

  • No OSC 66 queries (explicitWidthQuery, scaledTextQuery) are sent
  • explicit_width capability is disabled
  • No artifacts appear on older terminals

Backward compatibility:

  • Default behavior unchanged (queries still sent by default)
  • Modern terminals continue to work as before
  • Only activates when user explicitly sets environment variable

Tests:

  • Added 3 new tests for OSC 66 query behavior
  • All new tests pass (4/5 passed, 1 skipped for Windows)
  • All existing TypeScript tests pass (3136/3136)

Documentation:

  • Added Terminal Compatibility section to packages/core/docs/development.md
  • Updated packages/core/docs/env-vars.md with clarified documentation

@jobrk jobrk force-pushed the fix/osc66-terminal-compatibility branch from 55ab1f9 to ed2d40e Compare January 31, 2026 22:01
@pkg-pr-new
Copy link

pkg-pr-new bot commented Jan 31, 2026

@opentui/core

npm i https://pkg.pr.new/anomalyco/opentui/@opentui/core@605

@opentui/react

npm i https://pkg.pr.new/anomalyco/opentui/@opentui/react@605

@opentui/solid

npm i https://pkg.pr.new/anomalyco/opentui/@opentui/solid@605

@opentui/core-darwin-arm64

npm i https://pkg.pr.new/anomalyco/opentui/@opentui/core-darwin-arm64@605

@opentui/core-darwin-x64

npm i https://pkg.pr.new/anomalyco/opentui/@opentui/core-darwin-x64@605

@opentui/core-linux-arm64

npm i https://pkg.pr.new/anomalyco/opentui/@opentui/core-linux-arm64@605

@opentui/core-linux-x64

npm i https://pkg.pr.new/anomalyco/opentui/@opentui/core-linux-x64@605

@opentui/core-win32-arm64

npm i https://pkg.pr.new/anomalyco/opentui/@opentui/core-win32-arm64@605

@opentui/core-win32-x64

npm i https://pkg.pr.new/anomalyco/opentui/@opentui/core-win32-x64@605

commit: da5d3d5

jobrk added 2 commits February 1, 2026 10:58
Fixes compatibility issues with older terminal emulators (e.g., GNOME Terminal)
that don't support OSC 66 escape sequences. These terminals were displaying
visible artifacts containing "66" when OpenTUI applications ran.

Changes:
- Enhanced OPENTUI_FORCE_EXPLICIT_WIDTH environment variable to skip OSC 66
  queries when set to "false" or "0"
- Added skip_explicit_width_query flag to Terminal struct
- Modified queryTerminalSend() to conditionally skip OSC 66 queries
- Added comprehensive tests for the new behavior
- Updated environment variable documentation
- Added Terminal Compatibility section to development.md

When OPENTUI_FORCE_EXPLICIT_WIDTH=false:
- No OSC 66 queries (explicitWidthQuery, scaledTextQuery) are sent
- explicit_width capability is disabled
- No artifacts appear on older terminals

Backward compatibility:
- Default behavior unchanged (queries still sent by default)
- Modern terminals continue to work as before
- Only activates when user explicitly sets environment variable

Tests:
- Added 3 new tests for OSC 66 query behavior
- All new tests pass (4/5 passed, 1 skipped for Windows)
- All existing TypeScript tests pass (3136/3136)

Documentation:
- Added Terminal Compatibility section to packages/core/docs/development.md
- Updated packages/core/docs/env-vars.md with clarified documentation
@jobrk jobrk force-pushed the fix/osc66-terminal-compatibility branch from ff5a975 to 88edab1 Compare February 1, 2026 10:58
@kommander kommander merged commit b2f1461 into anomalyco:main Feb 2, 2026
6 checks passed
@jobrk jobrk deleted the fix/osc66-terminal-compatibility branch February 2, 2026 07:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants