Fix flickering cursor style when a pane was zoomed (#8546)

Release Notes:

- N/A

Co-authored-by: Max Brunsfeld <max@zed.dev>
This commit is contained in:
Antonio Scandurra 2024-02-28 18:50:48 +01:00 committed by GitHub
parent 7efa8d079d
commit 57f5f128f3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 8 additions and 3 deletions

View file

@ -716,6 +716,11 @@ impl EditorElement {
let scroll_position = layout.position_map.snapshot.scroll_position();
let scroll_top = scroll_position.y * line_height;
if bounds.contains(&cx.mouse_position()) {
let stacking_order = cx.stacking_order().clone();
cx.set_cursor_style(CursorStyle::Arrow, stacking_order);
}
let show_git_gutter = matches!(
ProjectSettings::get_global(cx).git.git_gutter,
Some(GitGutterSetting::TrackedFiles)
@ -915,7 +920,7 @@ impl EditorElement {
bounds: text_bounds,
stacking_order: cx.stacking_order().clone(),
};
if interactive_text_bounds.visibly_contains(&cx.mouse_position(), cx) {
if text_bounds.contains(&cx.mouse_position()) {
if self
.editor
.read(cx)
@ -1557,7 +1562,7 @@ impl EditorElement {
stacking_order: cx.stacking_order().clone(),
};
let mut mouse_position = cx.mouse_position();
if interactive_track_bounds.visibly_contains(&mouse_position, cx) {
if track_bounds.contains(&mouse_position) {
cx.set_cursor_style(
CursorStyle::Arrow,
interactive_track_bounds.stacking_order.clone(),

View file

@ -409,7 +409,7 @@ impl<'a> ElementContext<'a> {
.requested_cursor_style
.as_ref()
.map_or(true, |prev_style_request| {
style_request.stacking_order > prev_style_request.stacking_order
style_request.stacking_order >= prev_style_request.stacking_order
})
{
self.window.next_frame.requested_cursor_style = Some(style_request.clone());