Expose pane terminal modes to direct TerminalAttach clients #3360
KaminariOS
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Problem
Direct
TerminalAttachclients receive rendered pane frames but not the pane application’s terminal-mode state.Herdr parses the child PTY output into its terminal runtime and sends rendered cell differences. The original DECSET transitions therefore do not reach the attaching client’s terminal emulator.
A client cannot determine whether the pane application has enabled:
47,1047, or1049)1000,1002, or1003)1006,1015, or1016)The existing
MouseCapturemessage represents Herdr’s outer UI capture behavior, not the attached pane application’s requested mouse protocol.Why this matters
A graphical client such as an Android Herdr client needs to distinguish:
cat -v, which requested no mouse input.If the client forwards every tap, ordinary programs receive unexpected input such as:
If the client forwards taps only when its terminal emulator reports mouse tracking, TUI taps do not work—the emulator never receives the mode transitions Herdr consumed.
Rendered screen contents, Ratatui usage, and alternate-screen appearance are not reliable substitutes for the actual terminal state.
Proposed protocol behavior
Send each
TerminalAttachclient an initial pane-mode snapshot when it attaches, followed by ordered updates whenever the state changes.The state could include:
The exact wire representation is flexible. The important properties are:
Alternatively, the rendered stream could preserve the relevant DECSET transitions so the attaching terminal emulator observes them naturally.
Client behavior enabled by this
A client could mirror the reported modes into its terminal emulator and dispatch native mouse events only while the pane application has requested them.
The terminal emulator would remain responsible for encoding input according to the requested protocol. Clients would not need to construct SGR sequences or guess whether a TUI is active.
This produces safe behavior:
cat -vor a shell: taps send no PTY input.Scope
This proposal does not require Herdr to synthesize click sequences or change its own TUI mouse handling.
It only exposes pane terminal state already tracked by Herdr’s terminal runtime so direct-attach clients can make correct input-routing decisions.
Related reports
alternate-screen offequivalent #1304 — alternate-screen behavior and scrollbackAll reactions