# terminal: Add ctrl\+click link detection with mouse movement \(\#42526\) · gitcafe/zed

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

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

Visibility: public

Requested revision: 935a7cc310db486b1e08483f24f26e7935e53679

Requested commit: 935a7cc310db486b1e08483f24f26e7935e53679

Commit: 935a7cc310db486b1e08483f24f26e7935e53679

Tree: f7dd6ce4532dde85ef51544ed6f213d7d0ba161d

Author: Nihal Kumar

Committer: GitHub

## Message

```
terminal: Add ctrl+click link detection with mouse movement (#42526)

Closes #41994

This PR introduces Element-bounded drag tolerance for Ctrl/Cmd+click in
terminal.

Previously, Ctrl/Cmd+click on terminal links required pixel-perfect
accuracy. Any mouse movement during the click would cancel the
navigation, making it frustrating to click on links, especially on
high-DPI displays or with sensitive mice.

Users can now click anywhere within a clickable element (file path, URL,
hyperlink), drag the cursor anywhere within that same element's
boundaries and release to trigger navigation

Implementation:

- Stores detected element metadata (`text` and `grid_range`) on
Ctrl/Cmd+mouse-down
- Tracks cursor position during drag, preserving click state while
within element bounds
  - Verifies element match on mouse-up before triggering navigation
  - Uses existing `find_from_grid_point()` for element detection

Before:


[before.webm](https://github.com/user-attachments/assets/ee80de66-998e-4d8e-94d0-f5e65eb06d22)

After:


[after.webm](https://github.com/user-attachments/assets/7c9ddd9e-cfc1-4c79-b62c-78e9d909e6f4)

Release Notes:

- terminal: Fixed an issue where `ctrl|cmd+click` on links was very
sensitive to mouse movement. Clicking links now tolerates mouse movement
within the same clickable element, making link navigation more reliable

---------

Co-authored-by: Ben Kunkle <ben@zed.dev>
```

## Parents

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

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