Add support for tmux#48
Open
ndeloof wants to merge 1 commit into
Open
Conversation
Inside tmux, TERM is usually tmux* or screen*, whose terminfo entries describe cursor keys in keypad transmit mode (kcuu1=\EOA, ...). This library never emits smkx, so tmux actually sends the normal-mode sequences (\E[A, ...): every arrow key ended up misparsed as an Alt combo (KeyEsc + rune '[') and the trailing byte was swallowed. tmux translates keys itself, so the sequences it emits do not depend on the outer terminal: same as screen for Home/End (\E[1~, \E[4~) but with normal-mode cursor keys. Add a dedicated built-in key table, select it whenever $TMUX is set (whatever TERM is), and register tmux/tmux-256color in the built-in and compatibility tables. Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
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.
Inside tmux,
TERMis usuallytmux*orscreen*, whose terminfo entries describe cursor keys in keypad transmit mode (kcuu1=\EOA, …). This library never emitssmkx, so tmux actually sends the normal-mode sequences (\E[A, …): every arrow key is misparsed as an Alt combo (KeyEsc+ rune'[') and the trailing byte is swallowed; Home/End/F-keys are garbled the same way.tmux translates keys itself, so what it emits does not depend on the outer terminal (verified empirically with
cat -vinside a pane): same as screen for Home/End (\E[1~,\E[4~) but with normal-mode cursor keys. This adds a dedicated built-in key table, selects it whenever$TMUXis set (whateverTERMis, soTERM=screen*setups are covered too), and registerstmux/tmux-256colorin the built-in and compatibility tables.Tested end-to-end on macOS with tmux 3.5: arrows, Home/End, F1/F5/F12, Insert/Delete, PgUp/PgDn and plain runes are all reported correctly, where master reports Alt-combo garbage.
🤖 Generated with Claude Code