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
7738 }7738 }
7739 })7739 })
7740 .await;7740 .await;
7741 let rows = Self::refresh_runnable_display_rows(7741 let rows = Self::runnable_rows(project, display_snapshot, new_rows, cx.clone());
7742 project,
7743 display_snapshot,
7744 new_rows,
7745 cx.clone(),
7746 );
7747 7742
7748 this.update(&mut cx, |this, _| {7743 this.update(&mut cx, |this, _| {
7749 this.clear_tasks();7744 this.clear_tasks();
@@ -7760,7 +7755,8 @@ impl Editor { · 10 unmodified lines
7760 ) -> Vec<(Range<usize>, Runnable)> {7755 ) -> Vec<(Range<usize>, Runnable)> {
7761 snapshot.buffer_snapshot.runnable_ranges(range).collect()7756 snapshot.buffer_snapshot.runnable_ranges(range).collect()
7762 }7757 }
7763 fn refresh_runnable_display_rows(7758
7759 fn runnable_rows(
7764 project: Model<Project>,7760 project: Model<Project>,
7765 snapshot: DisplaySnapshot,7761 snapshot: DisplaySnapshot,
7766 runnable_ranges: Vec<(Range<usize>, Runnable)>,7762 runnable_ranges: Vec<(Range<usize>, Runnable)>,
@@ -7775,12 +7771,12 @@ impl Editor { · 8 unmodified lines
7775 if tasks.is_empty() {7771 if tasks.is_empty() {
7776 return None;7772 return None;
7777 }7773 }
7778 let point = multi_buffer_range.start.to_display_point(&snapshot);7774 let point = multi_buffer_range.start.to_point(&snapshot.buffer_snapshot);
7779 Some((7775 Some((
7780 point.row(),7776 point.row,
7781 RunnableTasks {7777 RunnableTasks {
7782 templates: tasks,7778 templates: tasks,
7783 column: point.column(),7779 column: point.column,
7784 },7780 },
7785 ))7781 ))
7786 })7782 })
crates/editor/src/element.rs+6−2
@@ -1381,6 +1381,7 @@ impl EditorElement { · 1380 unmodified lines
1381 scroll_pixel_position: gpui::Point<Pixels>,1381 scroll_pixel_position: gpui::Point<Pixels>,
1382 gutter_dimensions: &GutterDimensions,1382 gutter_dimensions: &GutterDimensions,
1383 gutter_hitbox: &Hitbox,1383 gutter_hitbox: &Hitbox,
1384 snapshot: &EditorSnapshot,
1384 cx: &mut WindowContext,1385 cx: &mut WindowContext,
1385 ) -> Vec<AnyElement> {1386 ) -> Vec<AnyElement> {
1386 self.editor.update(cx, |editor, cx| {1387 self.editor.update(cx, |editor, cx| {
@@ -1409,10 +1410,12 @@ impl EditorElement { · 22 unmodified lines
1409 *row,1410 *row,
1410 cx,1411 cx,
1411 );1412 );
1412 1413 let display_row = Point::new(*row, 0)
1414 .to_display_point(&snapshot.display_snapshot)
1415 .row();
1413 let button = prepaint_gutter_button(1416 let button = prepaint_gutter_button(
1414 button,1417 button,
1415 *row,1418 display_row,
1416 line_height,1419 line_height,
1417 gutter_dimensions,1420 gutter_dimensions,
1418 scroll_pixel_position,1421 scroll_pixel_position,
@@ -4043,6 +4046,7 @@ impl Element for EditorElement { · 2624 unmodified lines
4043 scroll_pixel_position,4046 scroll_pixel_position,
4044 &gutter_dimensions,4047 &gutter_dimensions,
4045 &gutter_hitbox,4048 &gutter_hitbox,
4049 &snapshot,
4046 cx,4050 cx,
4047 );4051 );
4048 4052