diff --git a/crates/language/src/lib.rs b/crates/language/src/lib.rs index 8d0f06a648..6142b506b5 100644 --- a/crates/language/src/lib.rs +++ b/crates/language/src/lib.rs @@ -638,7 +638,10 @@ impl Buffer { if selection.start.column == 0 { let delta = Point::new( 0, - indent_columns.get(&selection.start.row).copied().unwrap_or(0), + indent_columns + .get(&selection.start.row) + .copied() + .unwrap_or(0), ); if delta.column > 0 { return Selection { diff --git a/crates/project/src/worktree.rs b/crates/project/src/worktree.rs index 61e4dfc9a4..8ad4583b34 100644 --- a/crates/project/src/worktree.rs +++ b/crates/project/src/worktree.rs @@ -3348,15 +3348,15 @@ mod tests { .await .unwrap(); - // Add a cursor at the start of each row. + // Add a cursor on each row. let selection_set_id = buffer.update(&mut cx, |buffer, cx| { assert!(!buffer.is_dirty()); buffer.add_selection_set( &(0..3) .map(|row| Selection { id: row as usize, - start: Point::new(row, 0), - end: Point::new(row, 0), + start: Point::new(row, 1), + end: Point::new(row, 1), reversed: false, goal: SelectionGoal::None, }) @@ -3378,7 +3378,7 @@ mod tests { // contents are edited according to the diff between the old and new // file contents. buffer - .condition(&cx, |buffer, _| buffer.text() != initial_contents) + .condition(&cx, |buffer, _| buffer.text() == new_contents) .await; buffer.update(&mut cx, |buffer, _| { @@ -3386,8 +3386,9 @@ mod tests { assert!(!buffer.is_dirty()); assert!(!buffer.has_conflict()); - let set = buffer.selection_set(selection_set_id).unwrap(); - let cursor_positions = set + let cursor_positions = buffer + .selection_set(selection_set_id) + .unwrap() .point_selections(&*buffer) .map(|selection| { assert_eq!(selection.start, selection.end); @@ -3396,7 +3397,7 @@ mod tests { .collect::>(); assert_eq!( cursor_positions, - &[Point::new(1, 0), Point::new(3, 0), Point::new(4, 0),] + [Point::new(1, 1), Point::new(3, 1), Point::new(4, 0)] ); });