editor: Fix task indicator layout for wrapped lines

This commit is contained in:
Piotr Osiewicz 2024-05-08 13:44:09 +02:00
parent ca680f07f7
commit 65f7238777
2 changed files with 12 additions and 12 deletions

View file

@ -7738,12 +7738,7 @@ impl Editor {
} }
}) })
.await; .await;
let rows = Self::refresh_runnable_display_rows( let rows = Self::runnable_rows(project, display_snapshot, new_rows, cx.clone());
project,
display_snapshot,
new_rows,
cx.clone(),
);
this.update(&mut cx, |this, _| { this.update(&mut cx, |this, _| {
this.clear_tasks(); this.clear_tasks();
@ -7760,7 +7755,8 @@ impl Editor {
) -> Vec<(Range<usize>, Runnable)> { ) -> Vec<(Range<usize>, Runnable)> {
snapshot.buffer_snapshot.runnable_ranges(range).collect() snapshot.buffer_snapshot.runnable_ranges(range).collect()
} }
fn refresh_runnable_display_rows(
fn runnable_rows(
project: Model<Project>, project: Model<Project>,
snapshot: DisplaySnapshot, snapshot: DisplaySnapshot,
runnable_ranges: Vec<(Range<usize>, Runnable)>, runnable_ranges: Vec<(Range<usize>, Runnable)>,
@ -7775,12 +7771,12 @@ impl Editor {
if tasks.is_empty() { if tasks.is_empty() {
return None; return None;
} }
let point = multi_buffer_range.start.to_display_point(&snapshot); let point = multi_buffer_range.start.to_point(&snapshot.buffer_snapshot);
Some(( Some((
point.row(), point.row,
RunnableTasks { RunnableTasks {
templates: tasks, templates: tasks,
column: point.column(), column: point.column,
}, },
)) ))
}) })

View file

@ -1381,6 +1381,7 @@ impl EditorElement {
scroll_pixel_position: gpui::Point<Pixels>, scroll_pixel_position: gpui::Point<Pixels>,
gutter_dimensions: &GutterDimensions, gutter_dimensions: &GutterDimensions,
gutter_hitbox: &Hitbox, gutter_hitbox: &Hitbox,
snapshot: &EditorSnapshot,
cx: &mut WindowContext, cx: &mut WindowContext,
) -> Vec<AnyElement> { ) -> Vec<AnyElement> {
self.editor.update(cx, |editor, cx| { self.editor.update(cx, |editor, cx| {
@ -1409,10 +1410,12 @@ impl EditorElement {
*row, *row,
cx, cx,
); );
let display_row = Point::new(*row, 0)
.to_display_point(&snapshot.display_snapshot)
.row();
let button = prepaint_gutter_button( let button = prepaint_gutter_button(
button, button,
*row, display_row,
line_height, line_height,
gutter_dimensions, gutter_dimensions,
scroll_pixel_position, scroll_pixel_position,
@ -4043,6 +4046,7 @@ impl Element for EditorElement {
scroll_pixel_position, scroll_pixel_position,
&gutter_dimensions, &gutter_dimensions,
&gutter_hitbox, &gutter_hitbox,
&snapshot,
cx, cx,
); );