Skip to content

terminal/tmux: parse %output without a regex - #14947

Merged
mitchellh merged 1 commit into
ghostty-org:mainfrom
jcollie:tmux-output-no-regex
Oct 31, 2026
Merged

mitchellh merged 1 commit into
ghostty-org:mainfrom
jcollie:tmux-output-no-regex

Conversation

@jcollie

@jcollie jcollie commented Oct 30, 2026

Copy link
Copy Markdown
Member

Parse %output %<pane> <data> by hand instead of compiling an Oniguruma regex for every pane write, matching how %window-close and %session-window-changed are already parsed.

The pane id now goes through parseDecimalId, so an id that overflows usize is logged and dropped rather than hitting catch unreachable. Empty data is accepted rather than rejected.

AI disclosure: Claude Code was used in the preparation of this PR.

Parse `%output %<pane> <data>` by hand instead of compiling an
Oniguruma regex for every pane write, matching how %window-close and
%session-window-changed are already parsed.

The pane id now goes through parseDecimalId, so an id that overflows
usize is logged and dropped rather than hitting `catch unreachable`.
Empty data is accepted rather than rejected.

The data is sliced from the line directly rather than through
std.mem.cutPrefix, which returns a const slice, so that it keeps the
mutability of the parser buffer it points into.
@jcollie
jcollie requested a review from a team as a code owner October 30, 2026 06:01
@mitchellh
mitchellh merged commit ae0dc1b into ghostty-org:main Oct 31, 2026
119 checks passed
@github-actions github-actions Bot added this to the 1.5.0 milestone Oct 31, 2026
@jcollie
jcollie deleted the tmux-output-no-regex branch October 31, 2026 05:39
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.

2 participants