Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions bin/bwopencode
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@
# - Namespace tools: masked (nsenter, unshare, chroot)
# - Keyring tools: masked (keyctl)
# - SSH/GPG agent env vars: stripped
# - Zellij env vars (ZELLIJ, ZELLIJ_SESSION_NAME, ZELLIJ_PANE_ID): passed;
# inside Zellij OPENTUI_FORCE_WCWIDTH=1 is also set so the TUI's column
# counts match Zellij's (a user-set OPENTUI_FORCE_WCWIDTH wins)
# - ~/.bashrc and other shell rc files: not mounted
#
# Usage:
Expand Down
3 changes: 3 additions & 0 deletions bin/bwopencode2
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@
# - Namespace tools: masked (nsenter, unshare, chroot)
# - Keyring tools: masked (keyctl)
# - SSH/GPG agent env vars: stripped
# - Zellij env vars (ZELLIJ, ZELLIJ_SESSION_NAME, ZELLIJ_PANE_ID): passed;
# inside Zellij OPENTUI_FORCE_WCWIDTH=1 is also set so the TUI's column
# counts match Zellij's (a user-set OPENTUI_FORCE_WCWIDTH wins)
# - ~/.bashrc and other shell rc files: not mounted
#
# Sandbox-escape guard: OpenCode 2 normally talks to a shared background
Expand Down
16 changes: 16 additions & 0 deletions lib/bwrap_sandbox_lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2601,6 +2601,22 @@ build_env_vars() {
pass_through_if_set COLORTERM
pass_through_if_set TERM_PROGRAM

# Zellij: these only identify the session (no socket is mounted), so
# OpenTUI can tell it runs inside Zellij. 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 the
# screen is left garbled until a resize. Count each code point on its
# own (OPENTUI_FORCE_WCWIDTH, which OpenTUI only tests for presence)
# unless the user set it themselves.
pass_through_if_set ZELLIJ
pass_through_if_set ZELLIJ_SESSION_NAME
pass_through_if_set ZELLIJ_PANE_ID
if [[ -n "${OPENTUI_FORCE_WCWIDTH+x}" ]]; then
SANDBOX_ENV+=("OPENTUI_FORCE_WCWIDTH=${OPENTUI_FORCE_WCWIDTH}")
elif [[ -n "${ZELLIJ:-}" ]]; then
SANDBOX_ENV+=("OPENTUI_FORCE_WCWIDTH=1")
fi

# Locale
pass_through_if_set LANG
pass_through_if_set LC_ALL
Expand Down