History

editor: Fix task indicator layout for wrapped lines

Piotr Osiewicz committed 2 years ago

Commit 65f72381 parent ca680f02 files · +12 −12Browse files

Unified · Split

2 files
  1. crates/editor/src/editor.rs +6 −10
  2. crates/editor/src/element.rs +6 −2
crates/editor/src/editor.rs+6−10
@@ -7738,12 +7738,7 @@ impl Editor { · 7737 unmodified lines
77387738 }
77397739 })
77407740 .await;
7741− let rows = Self::refresh_runnable_display_rows(
7742− project,
7743− display_snapshot,
7744− new_rows,
7745− cx.clone(),
7746− );
7741+ let rows = Self::runnable_rows(project, display_snapshot, new_rows, cx.clone());
77477742
77487743 this.update(&mut cx, |this, _| {
77497744 this.clear_tasks();
@@ -7760,7 +7755,8 @@ impl Editor { · 10 unmodified lines
77607755 ) -> Vec<(Range<usize>, Runnable)> {
77617756 snapshot.buffer_snapshot.runnable_ranges(range).collect()
77627757 }
7763− fn refresh_runnable_display_rows(
7758+
7759+ fn runnable_rows(
77647760 project: Model<Project>,
77657761 snapshot: DisplaySnapshot,
77667762 runnable_ranges: Vec<(Range<usize>, Runnable)>,
@@ -7775,12 +7771,12 @@ impl Editor { · 8 unmodified lines
77757771 if tasks.is_empty() {
77767772 return None;
77777773 }
7778− let point = multi_buffer_range.start.to_display_point(&snapshot);
7774+ let point = multi_buffer_range.start.to_point(&snapshot.buffer_snapshot);
77797775 Some((
7780− point.row(),
7776+ point.row,
77817777 RunnableTasks {
77827778 templates: tasks,
7783− column: point.column(),
7779+ column: point.column,
77847780 },
77857781 ))
77867782 })
crates/editor/src/element.rs+6−2
@@ -1381,6 +1381,7 @@ impl EditorElement { · 1380 unmodified lines
13811381 scroll_pixel_position: gpui::Point<Pixels>,
13821382 gutter_dimensions: &GutterDimensions,
13831383 gutter_hitbox: &Hitbox,
1384+ snapshot: &EditorSnapshot,
13841385 cx: &mut WindowContext,
13851386 ) -> Vec<AnyElement> {
13861387 self.editor.update(cx, |editor, cx| {
@@ -1409,10 +1410,12 @@ impl EditorElement { · 22 unmodified lines
14091410 *row,
14101411 cx,
14111412 );
1412−
1413+ let display_row = Point::new(*row, 0)
1414+ .to_display_point(&snapshot.display_snapshot)
1415+ .row();
14131416 let button = prepaint_gutter_button(
14141417 button,
1415− *row,
1418+ display_row,
14161419 line_height,
14171420 gutter_dimensions,
14181421 scroll_pixel_position,
@@ -4043,6 +4046,7 @@ impl Element for EditorElement { · 2624 unmodified lines
40434046 scroll_pixel_position,
40444047 &gutter_dimensions,
40454048 &gutter_hitbox,
4049+ &snapshot,
40464050 cx,
40474051 );
40484052