Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

Fix gutter hover breakpoint not updating when switching the tabs (#43163)

shaik-zeeshan4b04be602051
diff --git a/crates/editor/src/editor.rs b/crates/editor/src/editor.rs
index e8d0011a98d..7a3c9b85945 100644
--- a/crates/editor/src/editor.rs
+++ b/crates/editor/src/editor.rs
@@ -105,10 +105,10 @@ use gpui::{
AvailableSpace, Background, Bounds, ClickEvent, ClipboardEntry, ClipboardItem, Context,
DispatchPhase, Edges, Entity, EntityInputHandler, EventEmitter, FocusHandle, FocusOutEvent,
Focusable, FontId, FontWeight, Global, HighlightStyle, Hsla, KeyContext, Modifiers,
- MouseButton, MouseDownEvent, PaintQuad, ParentElement, Pixels, Render, ScrollHandle,
- SharedString, Size, Stateful, Styled, Subscription, Task, TextStyle, TextStyleRefinement,
- UTF16Selection, UnderlineStyle, UniformListScrollHandle, WeakEntity, WeakFocusHandle, Window,
- div, point, prelude::*, pulsating_between, px, relative, size,
+ MouseButton, MouseDownEvent, MouseMoveEvent, PaintQuad, ParentElement, Pixels, Render,
+ ScrollHandle, SharedString, Size, Stateful, Styled, Subscription, Task, TextStyle,
+ TextStyleRefinement, UTF16Selection, UnderlineStyle, UniformListScrollHandle, WeakEntity,
+ WeakFocusHandle, Window, div, point, prelude::*, pulsating_between, px, relative, size,
};
use hover_links::{HoverLink, HoveredLinkState, find_file};
use hover_popover::{HoverState, hide_hover};
@@ -22169,6 +22169,20 @@ impl Editor {
);
}
});
+
+ if let Some(position_map) = self.last_position_map.clone() {
+ EditorElement::mouse_moved(
+ self,
+ &MouseMoveEvent {
+ position: window.mouse_position(),
+ pressed_button: None,
+ modifiers: window.modifiers(),
+ },
+ &position_map,
+ window,
+ cx,
+ );
+ }
}
}
diff --git a/crates/editor/src/element.rs b/crates/editor/src/element.rs
index 8801f203233..71c76c0cb3e 100644
--- a/crates/editor/src/element.rs
+++ b/crates/editor/src/element.rs
@@ -1158,7 +1158,7 @@ impl EditorElement {
}
}
- fn mouse_moved(
+ pub(crate) fn mouse_moved(
editor: &mut Editor,
event: &MouseMoveEvent,
position_map: &PositionMap,
@@ -1169,7 +1169,7 @@ impl EditorElement {
let gutter_hitbox = &position_map.gutter_hitbox;
let modifiers = event.modifiers;
let text_hovered = text_hitbox.is_hovered(window);
- let gutter_hovered = gutter_hitbox.is_hovered(window);
+ let gutter_hovered = gutter_hitbox.bounds.contains(&event.position);
editor.set_gutter_hovered(gutter_hovered, cx);
editor.show_mouse_cursor(cx);