Repository navigation
fix(bwrap): make OpenTUI width counting match Zellij - #30
Merged
Matt Snyder (maatthias) merged 1 commit intoOct 26, 2026
Merged
Conversation
Zellij drops zero-width code points (emoji variation selectors, ZWJ) and has no grapheme width mode, so OpenTUI's default width counting drifts from Zellij's and leaves the screen garbled until a resize. Pass ZELLIJ, ZELLIJ_SESSION_NAME and ZELLIJ_PANE_ID into the sandbox and set OPENTUI_FORCE_WCWIDTH=1 inside Zellij unless the user already set it. Assisted-by: opencode:claude-sonnet-5-5
There was a problem hiding this comment.
🟢 Approval recommended
The narrow shared-environment change preserves user overrides, serves both wrappers, and has no identified blocking issues.
No open issues 🎉
What changed in this PR
This PR addresses OpenCode TUI rendering drift inside Zellij by adjusting width-counting settings in the shared sandbox environment builder used by both wrappers.
Changes:
- Pass through Zellij session identifiers and default
OPENTUI_FORCE_WCWIDTHto1inside Zellij, preserving explicit user values. - Document the environment behavior in both OpenCode wrappers.
| File | Description |
|---|---|
| lib/bwrap_sandbox_lib.sh | Adds Zellij environment passthrough and the conditional width-counting default. |
| bin/bwopencode2 | Documents Zellij passthrough and width-counting behavior in comments. |
| bin/bwopencode | Documents the same behavior in comments. |
Review effort: Balanced
Matt Snyder (maatthias)
approved these changes
Oct 26, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Zellij drops zero-width code points (emoji variation selectors, ZWJ) and has
no grapheme width mode (DEC 2027), so OpenTUI's default width counting drifts
from Zellij's grid. OpenTUI only redraws cells it thinks changed, so the
OpenCode TUI is left garbled until a resize. OpenTUI switches to wcwidth
counting for tmux and screen, but not for Zellij.
OpenTUI can tell it runs inside Zellij (no Zellij socket is mounted).
set OPENTUI_FORCE_WCWIDTH.
Checked with --dry-run (the variables appear only when ZELLIJ is set) and
pre-commit (shfmt, shellcheck, codespell, gitleaks). Confirmed inside a
Zellij pane after restarting bwopencode2.
Assisted-by: opencode:claude-sonnet-5-5