Merge pull request #2053 from zed-industries/on-move-out

Hide hovers when mouse leaves area & window focus is lost
This commit is contained in:
Julia 2023-01-20 10:55:26 -05:00 committed by GitHub
commit b54b77b9ec
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 105 additions and 38 deletions

View file

@ -44,7 +44,7 @@ use gpui::{
ViewContext, ViewHandle, WeakViewHandle,
};
use highlight_matching_bracket::refresh_matching_bracket_highlights;
use hover_popover::{hide_hover, HoverState};
use hover_popover::{hide_hover, HideHover, HoverState};
pub use items::MAX_TAB_TITLE_LEN;
use itertools::Itertools;
pub use language::{char_kind, CharKind};
@ -1321,7 +1321,7 @@ impl Editor {
}
}
hide_hover(self, cx);
hide_hover(self, &HideHover, cx);
if old_cursor_position.to_display_point(&display_map).row()
!= new_cursor_position.to_display_point(&display_map).row()
@ -1696,7 +1696,7 @@ impl Editor {
return;
}
if hide_hover(self, cx) {
if hide_hover(self, &HideHover, cx) {
return;
}
@ -6176,7 +6176,7 @@ impl View for Editor {
cx.defer(move |cx| {
if let Some(editor) = handle.upgrade(cx) {
editor.update(cx, |editor, cx| {
hide_hover(editor, cx);
hide_hover(editor, &HideHover, cx);
hide_link_definition(editor, cx);
})
}
@ -6225,7 +6225,7 @@ impl View for Editor {
self.buffer
.update(cx, |buffer, cx| buffer.remove_active_selections(cx));
self.hide_context_menu(cx);
hide_hover(self, cx);
hide_hover(self, &HideHover, cx);
cx.emit(Event::Blurred);
cx.notify();
}