# Fix macOS mouse cursor flicker \(\#55068\) · gitcafe/zed

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

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

Visibility: public

Requested revision: d010b06a77d234e345e3c116b663bbfa5e6e036b

Requested commit: d010b06a77d234e345e3c116b663bbfa5e6e036b

Commit: d010b06a77d234e345e3c116b663bbfa5e6e036b

Tree: bdc5e73538fe3ef8e975870ba96dfde049aa1ea4

Author: Agus Zubiaga

Committer: GitHub

## Message

```
Fix macOS mouse cursor flicker (#55068)

#48029 introduced `set_document_path` which is frequently (we are also
working on a PR to make it less frequent) called as tabs and panes
update. Apparently, the AppKit function it uses
(`NSWindow::setRepresentedFilename`) can cause the current cursor style
to be reset, producing flicker as the cursor would change to `Arrow`
temporarily until the right cursor style is set again in the next frame.

This PR reworks how we set the cursor to use AppKit's
`resetCursorRects`, giving us a chance to re-set the cursor when the OS
decides to invalidate it.

Finally, it fixes a separate bug introduced in #50827 where moving the
mouse while typing in an editor would cause to the cursor to flicker
between `None` (hidden) -> `Arrow` -> `IBeam`. This was caused by
incorrectly resetting the cursor to `Arrow` when the last input came
from the keyboard.

Self-Review Checklist:

- [x] I've reviewed my own diff for quality, security, and reliability
- [x] Unsafe blocks (if any) have justifying comments
- [x] The content is consistent with the [UI/UX
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
- [ ] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable

Release Notes:

- N/A

---------

Co-authored-by: Bennet Bo Fenner <bennetbo@gmx.de>
```

## Parents

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

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