Fix macOS mouse cursor flicker#55068
Merged
JosephTLyons merged 4 commits intomainfrom Apr 28, 2026
Merged
Conversation
Co-authored-by: Bennet Bo Fenner <bennetbo@gmx.de>
Co-authored-by: Bennet Bo Fenner <bennetbo@gmx.de>
Co-authored-by: Bennet Bo Fenner <bennetbo@gmx.de>
MrSubidubi
approved these changes
Apr 28, 2026
tahayvr
pushed a commit
to tahayvr/zed
that referenced
this pull request
Apr 28, 2026
zed-industries#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 zed-industries#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>
AzureZee
added a commit
to AzureZee/gpuix
that referenced
this pull request
Apr 29, 2026
AzureZee
added a commit
to AzureZee/gpuix
that referenced
this pull request
Apr 29, 2026
ebaah46
pushed a commit
to ebaah46/zed
that referenced
this pull request
May 6, 2026
zed-industries#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 zed-industries#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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
#48029 introduced
set_document_pathwhich 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 toArrowtemporarily 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 toArrowwhen the last input came from the keyboard.Self-Review Checklist:
Release Notes: