Skip to content

fix: unset TERMINFO before keyboard.Open() to fix tmux terminal support - #340

Open
octo-patch wants to merge 1 commit into
plandex-ai:mainfrom
octo-patch:fix/issue-320-tmux-terminfo-unsupported-terminal
Open

fix: unset TERMINFO before keyboard.Open() to fix tmux terminal support#340
octo-patch wants to merge 1 commit into
plandex-ai:mainfrom
octo-patch:fix/issue-320-tmux-terminfo-unsupported-terminal

Conversation

@octo-patch

Copy link
Copy Markdown

Fixes #320

Problem

When a terminal emulator (e.g. Ghostty) sets $TERMINFO to a private directory containing only its own terminfo entries, the eiannone/keyboard library uses that directory exclusively — it does not fall through to $TERMINFO_DIRS or standard system paths. As a result, when running inside tmux, the library cannot locate tmux-256color and returns an "Unsupported terminal" error, which surfaces as:

🚨 Error confirming
  → Failed to get user input
    → Failed to open keyboard
      → Error while reading terminfo data:termbox
        → Unsupported terminal

This affects any user whose terminal sets $TERMINFO to a terminal-specific directory (Ghostty, Alacritty with custom terminfo, etc.) when also using tmux.

Solution

Temporarily unset $TERMINFO inside GetUserKeyInput() before calling keyboard.Open(). This allows the library to search $TERMINFO_DIRS and standard system paths (e.g. /usr/share/terminfo) where tmux-256color is available. The original value is restored via defer when the function returns.

The change is limited to the keyboard open call and does not affect any other behavior.

Testing

Reproduced locally by setting TERMINFO=/tmp/empty-terminfo TERM=tmux-256color and confirming that without the fix keyboard.Open() fails, while with the fix it succeeds by falling through to system terminfo paths.

When a terminal emulator (e.g. Ghostty) sets $TERMINFO to a private
directory containing only its own terminfo entries, the eiannone/keyboard
library uses that path exclusively and fails to locate tmux-256color when
running inside tmux, producing an "Unsupported terminal" error.

Temporarily unsetting $TERMINFO before keyboard.Open() allows the library
to fall through to $TERMINFO_DIRS and standard system paths where
tmux-256color is available. The variable is restored via defer once the
function returns.

Fixes plandex-ai#320
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.

Plandex fails with "Unsupported terminal" error inside tmux

1 participant