# editor: Toggle diff hunk based on current mouse position \(\#40773\) · gitcafe/zed

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

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

Visibility: public

Requested revision: 0aa7b7c7738f07c85fd7e8fb38c144c242502050

Requested commit: 0aa7b7c7738f07c85fd7e8fb38c144c242502050

Commit: 0aa7b7c7738f07c85fd7e8fb38c144c242502050

Tree: a7d722b0534d3d71e97038ac6d47b7fe10d2a98d

Author: Finn Evers

Committer: GitHub

## Message

```
editor: Toggle diff hunk based on current mouse position (#40773)

This fixes an issue where we would search for the hovered diff hunk
based on the mouse hit test computed during (or prior) editor paint
instead of the mouse hit test computed prior to the mouse event
invocation.

That in turn could lead to cases where moving the mouse from the editor
to the project panel and then clicking a file shortly after would expand
a diff hunk when actually nothing should happen in that case.

Release Notes:

- Fixed an issue where diff hunks would sometimes erroneously toggle
upon mouse clicks.
```

## Parents

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

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