Skip to content

Home/End keys not recognised inside tmux #6046

@Terrance

Description

@Terrance

The bug

When using tmux, bare Home and End keypresses don't seem to be recognised by name. (The real terminal is Windows Terminal as xterm-256color, and outside of tmux the keys are correctly detected.)

textual keys output for various combinations inside tmux:

Key(key='\x01', character='\x01', name='\x01', is_printable=False)
Key(key='\x04', character='\x04', name='\x04', is_printable=False)
Key(key='pageup', character=None, name='pageup', is_printable=False)
Key(key='pagedown', character=None, name='pagedown', is_printable=False)
Key(key='shift+home', character=None, name='shift_home', is_printable=False)
Key(key='shift+end', character=None, name='shift_end', is_printable=False)
Key(key='shift+pageup', character=None, name='shift_pageup', is_printable=False)
Key(key='shift+pagedown', character=None, name='shift_pagedown', is_printable=False)
Key(key='ctrl+home', character=None, name='ctrl_home', is_printable=False)
Key(key='ctrl+end', character=None, name='ctrl_end', is_printable=False)
Key(key='ctrl+pageup', character=None, name='ctrl_pageup', is_printable=False)
Key(key='ctrl+pagedown', character=None, name='ctrl_pagedown', is_printable=False)
Key(key='alt+home', character=None, name='alt_home', is_printable=False)
Key(key='alt+end', character=None, name='alt_end', is_printable=False)
Key(key='alt+pageup', character=None, name='alt_pageup', is_printable=False)
Key(key='alt+pagedown', character=None, name='alt_pagedown', is_printable=False)

Key detection is the same for both 3.0.0 (used by Posting) and the latest 5.3.0.


Textual Diagnostics

Versions

Name Value
Textual 3.0.0
Rich 14.0.0

Python

Name Value
Version 3.12.11
Implementation CPython
Compiler GCC 15.1.1 20250425
Executable /home/user/.local/share/pipx/venvs/posting/bin/python

Operating System

Name Value
System Linux
Release 6.6.87.1-microsoft-standard-WSL2
Version #1 SMP PREEMPT_DYNAMIC Mon Apr 21 17:08:54 UTC 2025

Terminal

Name Value
Terminal Application tmux (3.5a)
TERM tmux-256color
COLORTERM truecolor
FORCE_COLOR Not set
NO_COLOR Not set

Rich Console options

Name Value
size width=273, height=54
legacy_windows False
min_width 1
max_width 273
is_terminal True
encoding utf-8
max_height 54
justify None
overflow None
no_wrap False
highlight None
markup None
height None

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions