Revert "Remove into SelectionEffects from .change_selections"

This reverts commit 28380d714d.
This commit is contained in:
Conrad Irwin 2025-06-27 14:06:17 -06:00
parent 28380d714d
commit 6e762d9c05
65 changed files with 625 additions and 837 deletions

View file

@ -1302,7 +1302,6 @@ fn apply_hint_update(
#[cfg(test)]
pub mod tests {
use crate::SelectionEffects;
use crate::editor_tests::update_test_language_settings;
use crate::scroll::ScrollAmount;
use crate::{ExcerptRange, scroll::Autoscroll, test::editor_lsp_test_context::rust_lang};
@ -1385,9 +1384,7 @@ pub mod tests {
editor
.update(cx, |editor, window, cx| {
editor.change_selections(SelectionEffects::no_scroll(), window, cx, |s| {
s.select_ranges([13..13])
});
editor.change_selections(None, window, cx, |s| s.select_ranges([13..13]));
editor.handle_input("some change", window, cx);
})
.unwrap();
@ -1701,9 +1698,7 @@ pub mod tests {
rs_editor
.update(cx, |editor, window, cx| {
editor.change_selections(SelectionEffects::no_scroll(), window, cx, |s| {
s.select_ranges([13..13])
});
editor.change_selections(None, window, cx, |s| s.select_ranges([13..13]));
editor.handle_input("some rs change", window, cx);
})
.unwrap();
@ -1738,9 +1733,7 @@ pub mod tests {
md_editor
.update(cx, |editor, window, cx| {
editor.change_selections(SelectionEffects::no_scroll(), window, cx, |s| {
s.select_ranges([13..13])
});
editor.change_selections(None, window, cx, |s| s.select_ranges([13..13]));
editor.handle_input("some md change", window, cx);
})
.unwrap();
@ -2162,9 +2155,7 @@ pub mod tests {
] {
editor
.update(cx, |editor, window, cx| {
editor.change_selections(SelectionEffects::no_scroll(), window, cx, |s| {
s.select_ranges([13..13])
});
editor.change_selections(None, window, cx, |s| s.select_ranges([13..13]));
editor.handle_input(change_after_opening, window, cx);
})
.unwrap();
@ -2208,9 +2199,7 @@ pub mod tests {
edits.push(cx.spawn(|mut cx| async move {
task_editor
.update(&mut cx, |editor, window, cx| {
editor.change_selections(SelectionEffects::no_scroll(), window, cx, |s| {
s.select_ranges([13..13])
});
editor.change_selections(None, window, cx, |s| s.select_ranges([13..13]));
editor.handle_input(async_later_change, window, cx);
})
.unwrap();
@ -2458,12 +2447,9 @@ pub mod tests {
editor
.update(cx, |editor, window, cx| {
editor.change_selections(
SelectionEffects::scroll(Autoscroll::center()),
window,
cx,
|s| s.select_ranges([selection_in_cached_range..selection_in_cached_range]),
);
editor.change_selections(Some(Autoscroll::center()), window, cx, |s| {
s.select_ranges([selection_in_cached_range..selection_in_cached_range])
});
})
.unwrap();
cx.executor().advance_clock(Duration::from_millis(
@ -2726,24 +2712,15 @@ pub mod tests {
editor
.update(cx, |editor, window, cx| {
editor.change_selections(
SelectionEffects::scroll(Autoscroll::Next),
window,
cx,
|s| s.select_ranges([Point::new(4, 0)..Point::new(4, 0)]),
);
editor.change_selections(
SelectionEffects::scroll(Autoscroll::Next),
window,
cx,
|s| s.select_ranges([Point::new(22, 0)..Point::new(22, 0)]),
);
editor.change_selections(
SelectionEffects::scroll(Autoscroll::Next),
window,
cx,
|s| s.select_ranges([Point::new(50, 0)..Point::new(50, 0)]),
);
editor.change_selections(Some(Autoscroll::Next), window, cx, |s| {
s.select_ranges([Point::new(4, 0)..Point::new(4, 0)])
});
editor.change_selections(Some(Autoscroll::Next), window, cx, |s| {
s.select_ranges([Point::new(22, 0)..Point::new(22, 0)])
});
editor.change_selections(Some(Autoscroll::Next), window, cx, |s| {
s.select_ranges([Point::new(50, 0)..Point::new(50, 0)])
});
})
.unwrap();
cx.executor().run_until_parked();
@ -2768,12 +2745,9 @@ pub mod tests {
editor
.update(cx, |editor, window, cx| {
editor.change_selections(
SelectionEffects::scroll(Autoscroll::Next),
window,
cx,
|s| s.select_ranges([Point::new(100, 0)..Point::new(100, 0)]),
);
editor.change_selections(Some(Autoscroll::Next), window, cx, |s| {
s.select_ranges([Point::new(100, 0)..Point::new(100, 0)])
});
})
.unwrap();
cx.executor().advance_clock(Duration::from_millis(
@ -2804,12 +2778,9 @@ pub mod tests {
editor
.update(cx, |editor, window, cx| {
editor.change_selections(
SelectionEffects::scroll(Autoscroll::Next),
window,
cx,
|s| s.select_ranges([Point::new(4, 0)..Point::new(4, 0)]),
);
editor.change_selections(Some(Autoscroll::Next), window, cx, |s| {
s.select_ranges([Point::new(4, 0)..Point::new(4, 0)])
});
})
.unwrap();
cx.executor().advance_clock(Duration::from_millis(
@ -2841,7 +2812,7 @@ pub mod tests {
editor_edited.store(true, Ordering::Release);
editor
.update(cx, |editor, window, cx| {
editor.change_selections(SelectionEffects::no_scroll(), window, cx, |s| {
editor.change_selections(None, window, cx, |s| {
s.select_ranges([Point::new(57, 0)..Point::new(57, 0)])
});
editor.handle_input("++++more text++++", window, cx);
@ -3159,7 +3130,7 @@ pub mod tests {
cx.executor().run_until_parked();
editor
.update(cx, |editor, window, cx| {
editor.change_selections(SelectionEffects::no_scroll(), window, cx, |s| {
editor.change_selections(None, window, cx, |s| {
s.select_ranges([Point::new(10, 0)..Point::new(10, 0)])
})
})
@ -3441,7 +3412,7 @@ pub mod tests {
cx.executor().run_until_parked();
editor
.update(cx, |editor, window, cx| {
editor.change_selections(SelectionEffects::no_scroll(), window, cx, |s| {
editor.change_selections(None, window, cx, |s| {
s.select_ranges([Point::new(10, 0)..Point::new(10, 0)])
})
})