Fix vertical position in first_rect_for_character_range
This commit is contained in:
parent
86865431b9
commit
277fbda356
2 changed files with 14 additions and 16 deletions
|
@ -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;
|
||||
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::from_corners(
|
||||
element_bounds.origin + point(start_x, start_y),
|
||||
element_bounds.origin + point(end_x, end_y),
|
||||
))
|
||||
Some(Bounds {
|
||||
origin: element_bounds.origin + point(x, y),
|
||||
size: size(em_width, line_height),
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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),
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue