[PR #605] [MERGED] fix(terminal): add OSC 66 compatibility for older terminals #652

Closed
opened 2026-03-02 23:47:31 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/anomalyco/opentui/pull/605
Author: @jobrk
Created: 1/31/2026
Status: Merged
Merged: 2/2/2026
Merged by: @kommander

Base: mainHead: fix/osc66-terminal-compatibility


📝 Commits (3)

  • 2d1127d fix(terminal): add OSC 66 compatibility for older terminals
  • 88edab1 prettier
  • da5d3d5 Merge branch 'main' into fix/osc66-terminal-compatibility

📊 Changes

4 files changed (+145 additions, -8 deletions)

View changed files

📝 packages/core/docs/development.md (+51 -0)
📝 packages/core/docs/env-vars.md (+2 -2)
📝 packages/core/src/zig/terminal.zig (+11 -6)
📝 packages/core/src/zig/tests/terminal_test.zig (+81 -0)

📄 Description

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

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/anomalyco/opentui/pull/605 **Author:** [@jobrk](https://github.com/jobrk) **Created:** 1/31/2026 **Status:** ✅ Merged **Merged:** 2/2/2026 **Merged by:** [@kommander](https://github.com/kommander) **Base:** `main` ← **Head:** `fix/osc66-terminal-compatibility` --- ### 📝 Commits (3) - [`2d1127d`](https://github.com/anomalyco/opentui/commit/2d1127dc8113b675d172527e32529cfb101b51d6) fix(terminal): add OSC 66 compatibility for older terminals - [`88edab1`](https://github.com/anomalyco/opentui/commit/88edab11a6f308c2bb08d7e95dfdcb1d06b112ad) prettier - [`da5d3d5`](https://github.com/anomalyco/opentui/commit/da5d3d59e37df351cabf852387fc5d8cdc63ba41) Merge branch 'main' into fix/osc66-terminal-compatibility ### 📊 Changes **4 files changed** (+145 additions, -8 deletions) <details> <summary>View changed files</summary> 📝 `packages/core/docs/development.md` (+51 -0) 📝 `packages/core/docs/env-vars.md` (+2 -2) 📝 `packages/core/src/zig/terminal.zig` (+11 -6) 📝 `packages/core/src/zig/tests/terminal_test.zig` (+81 -0) </details> ### 📄 Description 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 --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-03-02 23:47:31 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/opentui#652
No description provided.