Change mouse cursor when link is visible

This commit is contained in:
Keith Simmons 2022-06-24 21:55:57 -07:00
parent a190eb0537
commit a8ea1048cf
2 changed files with 10 additions and 2 deletions

View file

@ -427,9 +427,14 @@ impl EditorElement {
let content_origin = bounds.origin() + vec2f(layout.gutter_margin, 0.); let content_origin = bounds.origin() + vec2f(layout.gutter_margin, 0.);
cx.scene.push_layer(Some(bounds)); cx.scene.push_layer(Some(bounds));
cx.scene.push_cursor_region(CursorRegion { cx.scene.push_cursor_region(CursorRegion {
bounds, bounds,
style: CursorStyle::IBeam, style: if !view.link_go_to_definition_state.definitions.is_empty() {
CursorStyle::PointingHand
} else {
CursorStyle::IBeam
},
}); });
for (range, color) in &layout.highlighted_ranges { for (range, color) in &layout.highlighted_ranges {

View file

@ -237,8 +237,11 @@ pub fn show_link_definition(
} }
pub fn hide_link_definition(editor: &mut Editor, cx: &mut ViewContext<Editor>) { pub fn hide_link_definition(editor: &mut Editor, cx: &mut ViewContext<Editor>) {
if editor.link_go_to_definition_state.symbol_range.is_some() { if editor.link_go_to_definition_state.symbol_range.is_some()
|| !editor.link_go_to_definition_state.definitions.is_empty()
{
editor.link_go_to_definition_state.symbol_range.take(); editor.link_go_to_definition_state.symbol_range.take();
editor.link_go_to_definition_state.definitions.clear();
cx.notify(); cx.notify();
} }