mirror of
https://github.com/zed-industries/zed.git
synced 2025-01-30 14:17:02 +00:00
Use display coordinates for the highlighted row in "go to line"
This commit is contained in:
parent
cb942a0e2f
commit
2449834868
1 changed files with 5 additions and 4 deletions
|
@ -1,5 +1,5 @@
|
||||||
use buffer::{Bias, Point, Selection};
|
use buffer::{Bias, Point, Selection};
|
||||||
use editor::{Autoscroll, Editor, EditorSettings};
|
use editor::{display_map::ToDisplayPoint, Autoscroll, Editor, EditorSettings};
|
||||||
use gpui::{
|
use gpui::{
|
||||||
action, elements::*, geometry::vector::Vector2F, keymap::Binding, Axis, Entity,
|
action, elements::*, geometry::vector::Vector2F, keymap::Binding, Axis, Entity,
|
||||||
MutableAppContext, RenderContext, View, ViewContext, ViewHandle,
|
MutableAppContext, RenderContext, View, ViewContext, ViewHandle,
|
||||||
|
@ -138,10 +138,11 @@ impl GoToLine {
|
||||||
)
|
)
|
||||||
}) {
|
}) {
|
||||||
self.line_selection = self.active_editor.update(cx, |active_editor, cx| {
|
self.line_selection = self.active_editor.update(cx, |active_editor, cx| {
|
||||||
let buffer = active_editor.buffer().read(cx);
|
let snapshot = active_editor.snapshot(cx).display_snapshot;
|
||||||
let point = buffer.clip_point(point, Bias::Left);
|
let point = snapshot.buffer_snapshot.clip_point(point, Bias::Left);
|
||||||
|
let display_point = point.to_display_point(&snapshot);
|
||||||
active_editor.select_ranges([point..point], Some(Autoscroll::Center), cx);
|
active_editor.select_ranges([point..point], Some(Autoscroll::Center), cx);
|
||||||
active_editor.set_highlighted_row(Some(point.row));
|
active_editor.set_highlighted_row(Some(display_point.row()));
|
||||||
Some(active_editor.newest_selection(cx))
|
Some(active_editor.newest_selection(cx))
|
||||||
});
|
});
|
||||||
cx.notify();
|
cx.notify();
|
||||||
|
|
Loading…
Reference in a new issue