Skip to content

core: size click_state to hold every mouse button - #14759

Merged
mitchellh merged 1 commit into
ghostty-org:mainfrom
jcollie:fix-mouse-click-state-eleven
Oct 19, 2026
Merged

mitchellh merged 1 commit into
ghostty-org:mainfrom
jcollie:fix-mouse-click-state-eleven

Conversation

@jcollie

@jcollie jcollie commented Oct 18, 2026

Copy link
Copy Markdown
Member

MouseButton.max is the largest enum value (11), not a count, so an array of that length has no slot for .eleven. Recording a press or release of button 11 indexed past the end, which panics in safe builds.

Size the array max + 1 and correct the doc comment on max that suggested using it directly as an array length.

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

MouseButton.max is the largest enum value (11), not a count, so an
array of that length has no slot for .eleven. Recording a press or
release of button 11 indexed past the end, which panics in safe builds.

Size the array max + 1 and correct the doc comment on max that
suggested using it directly as an array length.
@jcollie
jcollie requested a review from a team as a code owner October 18, 2026 17:51
@jcollie jcollie added this to the 1.4.0 milestone Oct 19, 2026
@mitchellh
mitchellh merged commit 7c9b7da into ghostty-org:main Oct 19, 2026
307 of 312 checks passed
@jcollie
jcollie deleted the fix-mouse-click-state-eleven branch October 19, 2026 16:45
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.

3 participants