# terminal: Open links with Cmd/Ctrl-click when mouse mode is enabled \(\#60067\) · gitcafe/zed

[View on GitCafe](https://git.cafe/gitcafe/zed/commit/f5c975162cf217f2c9cd1a2c1192eb2bb4653cdc)

Repository: [gitcafe/zed](https://git.cafe/gitcafe/zed)

Visibility: public

Requested revision: f5c975162cf217f2c9cd1a2c1192eb2bb4653cdc

Requested commit: f5c975162cf217f2c9cd1a2c1192eb2bb4653cdc

Commit: f5c975162cf217f2c9cd1a2c1192eb2bb4653cdc

Tree: 33b2a7c24d5abd9a6f1ddfe1cd2de757bc96ae32

Author: Tianze Zhao

Committer: GitHub

## Message

```
terminal: Open links with Cmd/Ctrl-click when mouse mode is enabled (#60067)

This fixes #56956.

The terminal link-open gesture was split between `mouse_down` and
`mouse_up`, but both halves only ran in the non-mouse-reporting path.
When a foreground app enabled terminal mouse reporting, a secondary
click on a URL or file path was forwarded to the PTY instead of opening
the link.

This changes secondary-click link handling so it checks for a hyperlink
before mouse reporting on press, and completes the matching hyperlink
open before mouse reporting on release. The event is only consumed when
the click actually lands on the same link, so normal clicks in
mouse-reporting TUIs continue to be forwarded as before.

Validation:

- `CARGO_BUILD_JOBS=1 cargo test -j1 -p terminal
test_hyperlink_ctrl_click_same_position_in_mouse_mode`
- `CARGO_BUILD_JOBS=1 cargo check -j1 -p terminal`

Release Notes:

- Improved terminal links: Cmd/Ctrl-click now opens links even when the
application has mouse reporting enabled (e.g. vim, opencode, claude).
Disable `terminal.open_links_in_mouse_mode` to forward these clicks to
the application instead.

---------

Co-authored-by: Smit Barmase <heysmitbarmase@gmail.com>
```

## Parents

- [739f23926d58a5c4dbda736e5b3b2ebd943337de](https://git.cafe/gitcafe/zed/commit/739f23926d58a5c4dbda736e5b3b2ebd943337de?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zed/tree/f5c975162cf217f2c9cd1a2c1192eb2bb4653cdc?format=markdown)
