diff --git a/crates/editor/src/editor.rs b/crates/editor/src/editor.rs index 8963d9a141..3523413db4 100644 --- a/crates/editor/src/editor.rs +++ b/crates/editor/src/editor.rs @@ -5762,14 +5762,24 @@ impl Editor { let display_map = self.display_map.update(cx, |map, cx| map.snapshot(cx)); let selections = self.selections.all::(cx); + dbg!(&selections); for selection in selections { let range = selection.range().sorted(); let buffer_start_row = range.start.row; for row in (0..=range.end.row).rev() { - let fold_range = display_map.foldable_range(row); + dbg!(row); + let fold_range = dbg!(display_map.foldable_range(row)); if let Some(fold_range) = fold_range { + let display_point = fold_range.end.to_display_point(&display_map); + let line = display_map + .chars_at(DisplayPoint::new(display_point.row(), 0)) + .map(|(ccharr, _)| ccharr) + .take_while(|charr| charr != &'\n') + .collect::(); + dbg!(line); + if fold_range.end.row >= buffer_start_row { fold_ranges.push(fold_range); if row <= range.start.row { diff --git a/crates/editor/src/editor_tests.rs b/crates/editor/src/editor_tests.rs index 4f61bde398..92ec518c88 100644 --- a/crates/editor/src/editor_tests.rs +++ b/crates/editor/src/editor_tests.rs @@ -679,7 +679,7 @@ fn test_fold(cx: &mut gpui::MutableAppContext) { " .unindent(), ); - + dbg!("SECOND FOLD"); view.fold(&Fold, cx); assert_eq!( view.display_text(cx),