Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
Fix vertical position in first_rect_for_character_range
Max Brunsfeld277fbda35696
diff --git a/crates/editor2/src/editor.rs b/crates/editor2/src/editor.rsindex 8cc58a87bff..2b64aa2e8b4 100644--- a/crates/editor2/src/editor.rs+++ b/crates/editor2/src/editor.rs@@ -39,11 +39,11 @@ use futures::FutureExt;use fuzzy::{StringMatch, StringMatchCandidate};use git::diff_hunk_to_display;use gpui::{- action, actions, div, point, px, relative, AnyElement, AppContext, BackgroundExecutor, Bounds,- ClipboardItem, Context, DispatchContext, Div, Element, Entity, EventEmitter, FocusHandle,- FontStyle, FontWeight, HighlightStyle, Hsla, InputHandler, Model, Pixels, PlatformInputHandler,- Render, Styled, Subscription, Task, TextStyle, View, ViewContext, VisualContext, WeakView,- WindowContext,+ action, actions, div, point, px, relative, size, AnyElement, AppContext, BackgroundExecutor,+ Bounds, ClipboardItem, Context, DispatchContext, Div, Element, Entity, EventEmitter,+ FocusHandle, FontStyle, FontWeight, HighlightStyle, Hsla, InputHandler, Model, Pixels,+ PlatformInputHandler, Render, Styled, Subscription, Task, TextStyle, View, ViewContext,+ VisualContext, WeakView, WindowContext,};use highlight_matching_bracket::refresh_matching_bracket_highlights;use hover_popover::{hide_hover, HoverState};@@ -9774,17 +9774,13 @@ impl InputHandler for Editor {let scroll_left = scroll_position.x * em_width;let start = OffsetUtf16(range_utf16.start).to_display_point(&snapshot);- let end = OffsetUtf16(range_utf16.end).to_display_point(&snapshot);- let start_y = line_height * (start.row() as f32 - scroll_position.y);- let end_y = line_height * (end.row() as f32 - scroll_position.y);- let start_x =- snapshot.x_for_point(start, &text_layout_details) - scroll_left + self.gutter_width;- let end_x = snapshot.x_for_point(end, &text_layout_details) - scroll_left;-- Some(Bounds::from_corners(- element_bounds.origin + point(start_x, start_y),- element_bounds.origin + point(end_x, end_y),- ))+ let x = snapshot.x_for_point(start, &text_layout_details) - scroll_left + self.gutter_width;+ let y = line_height * (start.row() as f32 - scroll_position.y);++ Some(Bounds {+ origin: element_bounds.origin + point(x, y),+ size: size(em_width, line_height),+ })}}diff --git a/crates/gpui2/src/platform/mac/window.rs b/crates/gpui2/src/platform/mac/window.rsindex bd45178e974..d07df3d94b3 100644--- a/crates/gpui2/src/platform/mac/window.rs+++ b/crates/gpui2/src/platform/mac/window.rs@@ -1485,7 +1485,9 @@ extern "C" fn first_rect_for_character_range(NSRect::new(NSPoint::new(frame.origin.x + bounds.origin.x.0 as f64,- frame.origin.y + frame.size.height - bounds.origin.y.0 as f64,+ frame.origin.y + frame.size.height+ - bounds.origin.y.0 as f64+ - bounds.size.height.0 as f64,),NSSize::new(bounds.size.width.0 as f64, bounds.size.height.0 as f64),)