mirror of
https://github.com/zed-industries/zed.git
synced 2024-11-08 07:35:01 +03:00
Fix unit test for on-disk-changes to not rely on selection bias
This commit is contained in:
parent
f3cd710f21
commit
9bc08e446b
@ -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 {
|
||||
|
@ -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::<Vec<_>>();
|
||||
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)]
|
||||
);
|
||||
});
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user