Move selection helpers to SelectionCollection, add update_anchor_selections, add a number of invariant preserving mutation functions to the MutableSelectionCollection
This commit is contained in:
parent
61b4a4202f
commit
c9dcfff607
22 changed files with 1891 additions and 1467 deletions
|
@ -3001,7 +3001,7 @@ mod tests {
|
|||
|
||||
// Type a completion trigger character as the guest.
|
||||
editor_b.update(cx_b, |editor, cx| {
|
||||
editor.select_ranges([13..13], None, cx);
|
||||
editor.change_selections(true, cx, |s| s.select_ranges([13..13], None));
|
||||
editor.handle_input(&Input(".".into()), cx);
|
||||
cx.focus(&editor_b);
|
||||
});
|
||||
|
@ -4213,7 +4213,9 @@ mod tests {
|
|||
|
||||
// Move cursor to a location that contains code actions.
|
||||
editor_b.update(cx_b, |editor, cx| {
|
||||
editor.select_ranges([Point::new(1, 31)..Point::new(1, 31)], None, cx);
|
||||
editor.change_selections(true, cx, |s| {
|
||||
s.select_ranges([Point::new(1, 31)..Point::new(1, 31)], None)
|
||||
});
|
||||
cx.focus(&editor_b);
|
||||
});
|
||||
|
||||
|
@ -4450,7 +4452,7 @@ mod tests {
|
|||
|
||||
// Move cursor to a location that can be renamed.
|
||||
let prepare_rename = editor_b.update(cx_b, |editor, cx| {
|
||||
editor.select_ranges([7..7], None, cx);
|
||||
editor.change_selections(true, cx, |s| s.select_ranges([7..7], None));
|
||||
editor.rename(&Rename, cx).unwrap()
|
||||
});
|
||||
|
||||
|
@ -5470,8 +5472,12 @@ mod tests {
|
|||
});
|
||||
|
||||
// When client B starts following client A, all visible view states are replicated to client B.
|
||||
editor_a1.update(cx_a, |editor, cx| editor.select_ranges([0..1], None, cx));
|
||||
editor_a2.update(cx_a, |editor, cx| editor.select_ranges([2..3], None, cx));
|
||||
editor_a1.update(cx_a, |editor, cx| {
|
||||
editor.change_selections(true, cx, |s| s.select_ranges([0..1], None))
|
||||
});
|
||||
editor_a2.update(cx_a, |editor, cx| {
|
||||
editor.change_selections(true, cx, |s| s.select_ranges([2..3], None))
|
||||
});
|
||||
workspace_b
|
||||
.update(cx_b, |workspace, cx| {
|
||||
workspace
|
||||
|
@ -5536,7 +5542,7 @@ mod tests {
|
|||
|
||||
// Changes to client A's editor are reflected on client B.
|
||||
editor_a1.update(cx_a, |editor, cx| {
|
||||
editor.select_ranges([1..1, 2..2], None, cx);
|
||||
editor.change_selections(true, cx, |s| s.select_ranges([1..1, 2..2], None));
|
||||
});
|
||||
editor_b1
|
||||
.condition(cx_b, |editor, cx| {
|
||||
|
@ -5550,7 +5556,7 @@ mod tests {
|
|||
.await;
|
||||
|
||||
editor_a1.update(cx_a, |editor, cx| {
|
||||
editor.select_ranges([3..3], None, cx);
|
||||
editor.change_selections(true, cx, |s| s.select_ranges([3..3], None));
|
||||
editor.set_scroll_position(vec2f(0., 100.), cx);
|
||||
});
|
||||
editor_b1
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue