# Rework mouse handling of git hunks diff \(\#14727\) · gitcafe/zed

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

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

Visibility: public

Requested revision: 18c2e8f6ca770c22187ed05c6f66dee9cc8579d2

Requested commit: 18c2e8f6ca770c22187ed05c6f66dee9cc8579d2

Commit: 18c2e8f6ca770c22187ed05c6f66dee9cc8579d2

Tree: cf268f09c936038e85fd722c80a6aa1511a98253

Author: Kirill Bulatov

Committer: GitHub

## Message

```
Rework mouse handling of git hunks diff (#14727)

Closes https://github.com/zed-industries/zed/issues/12404

![Screenshot 2024-07-18 at 14 02
31](https://github.com/user-attachments/assets/a8addd22-0ed9-4f4b-852a-f347314c27ce)

![Screenshot 2024-07-18 at 14 02
43](https://github.com/user-attachments/assets/0daaed10-b9f3-4d4b-b8d7-189aa7e013b9)

Video:


https://github.com/user-attachments/assets/58e62527-da75-4017-a43e-a37803bd7b49


* now shows a context menu on left click instead of expanding the hunk
diff
* hunk diffs can be toggled with a single cmd-click still
* adds a X mark into gutter for every hunk expanded
* makes `editor::ToggleDiffHunk` to work inside the deleted hunk editors

Additionally, changes the way editor context menus behave when the
editor is scrolled — right click and diff hunks context menu now will
stick to the place it was invoked at, instead of staying onscreen at the
same pixel positions.

Release Notes:

- Improved the way git hunks diff can be toggled with mouse
([#12404](https://github.com/zed-industries/zed/issues/12404))

---------

Co-authored-by: Nate Butler <nate@zed.dev>
Co-authored-by: Conrad Irwin <conrad@zed.dev>
```

## Parents

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

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