Skip to content

core: report the release of a tracked click on a prompt - #14710

Merged
mitchellh merged 1 commit into
ghostty-org:mainfrom
fornwall:prompt-click-tracking
Oct 15, 2026
Merged

mitchellh merged 1 commit into
ghostty-org:mainfrom
fornwall:prompt-click-tracking

Conversation

@fornwall

@fornwall fornwall commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

When the cursor is at a prompt with click-to-move (OSC 133 click_events or cl=) and a program started from that prompt tracks the mouse, a left click reaches the program as a press without a release (the release is instead replaced by the prompt click).

A release whose press went to the program now goes to the program too, instead of becoming a prompt click.

Steps to reproduce:

  1. Use ghostty shell integration.
  2. Use fzf shell integration, for example source <(fzf --zsh) under zsh. Tested with zsh; bash uses the same cl=line mark and fish uses click_events=1, so both should take the same path.
  3. Press Ctrl-R to open the fzf history search.
  4. Double click on a history item to select it.

Results:

  • Before: The history item is not inserted into the shell prompt, since fzf only completes a double click on the release event it never receives.
  • After: The history item is inserted into the shell prompt.

AI disclosure: Created with opus 5.5 through claude code. Reviewed and tested by me.

When the cursor is at a prompt that declared click_events=1 or cl=,
a left release ran the prompt click before the mouse report. Under
mouse tracking the press had already been reported, so the release
was replaced by a synthetic SGR press or arrow keys. Ghostty's own
shell integration hits this whenever a widget runs a mouse-tracking
program from the prompt, such as fzf's Ctrl-R binding.

The selection gesture is reset when a press is reported, so a zero
click count on release means the press reached the program. Skip the
prompt click then and report the release too. Shift+click under
tracking still records a gesture and moves the cursor.

Signed-off-by: Fredrik Fornwall <fredrik@fornwall.net>
@fornwall
fornwall requested a review from a team as a code owner October 14, 2026 20:38
@mitchellh
mitchellh merged commit a9139e5 into ghostty-org:main Oct 15, 2026
1 check passed
@github-actions github-actions Bot added this to the 1.4.0 milestone Oct 15, 2026
@fornwall
fornwall deleted the prompt-click-tracking branch October 15, 2026 05:07
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