Introduce a short-term solution for flickering (#8542)

This uses bounds checking alone to determine hover state to avoid
flicker. It's a short-term solution because the rendering is incorrect.
We think this is better than flickering though and buys us some time as
we work on a more robust solution overall.

Release Notes:

- Fixed flickering when hovering.

---------

Co-authored-by: Nathan <nathan@zed.dev>
This commit is contained in:
Antonio Scandurra 2024-02-28 17:57:20 +01:00 committed by GitHub
parent 517ea734ee
commit 7aba9eb4b7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 72 additions and 45 deletions

View file

@ -489,15 +489,12 @@ impl TerminalElement {
}
});
let interactive_text_bounds = InteractiveBounds {
bounds,
stacking_order: cx.stacking_order().clone(),
};
if interactive_text_bounds.visibly_contains(&cx.mouse_position(), cx) {
if bounds.contains(&cx.mouse_position()) {
let stacking_order = cx.stacking_order().clone();
if self.can_navigate_to_selected_word && last_hovered_word.is_some() {
cx.set_cursor_style(gpui::CursorStyle::PointingHand)
cx.set_cursor_style(gpui::CursorStyle::PointingHand, stacking_order);
} else {
cx.set_cursor_style(gpui::CursorStyle::IBeam)
cx.set_cursor_style(gpui::CursorStyle::IBeam, stacking_order);
}
}