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

@ -18,7 +18,7 @@ use client::zed_urls;
use collections::VecDeque;
use debugger_ui::debugger_panel::DebugPanel;
use editor::ProposedChangesEditorToolbar;
use editor::{Editor, MultiBuffer};
use editor::{Editor, MultiBuffer, scroll::Autoscroll};
use futures::future::Either;
use futures::{StreamExt, channel::mpsc, select_biased};
use git_ui::git_panel::GitPanel;
@ -1125,7 +1125,7 @@ fn open_log_file(workspace: &mut Workspace, window: &mut Window, cx: &mut Contex
editor.update(cx, |editor, cx| {
let last_multi_buffer_offset = editor.buffer().read(cx).len(cx);
editor.change_selections(Default::default(), window, cx, |s| {
editor.change_selections(Some(Autoscroll::fit()), window, cx, |s| {
s.select_ranges(Some(
last_multi_buffer_offset..last_multi_buffer_offset,
));
@ -1774,7 +1774,7 @@ mod tests {
use super::*;
use assets::Assets;
use collections::HashSet;
use editor::{DisplayPoint, Editor, SelectionEffects, display_map::DisplayRow};
use editor::{DisplayPoint, Editor, display_map::DisplayRow, scroll::Autoscroll};
use gpui::{
Action, AnyWindowHandle, App, AssetSource, BorrowAppContext, SemanticVersion,
TestAppContext, UpdateGlobal, VisualTestContext, WindowHandle, actions,
@ -3348,7 +3348,7 @@ mod tests {
workspace
.update(cx, |_, window, cx| {
editor1.update(cx, |editor, cx| {
editor.change_selections(Default::default(), window, cx, |s| {
editor.change_selections(Some(Autoscroll::fit()), window, cx, |s| {
s.select_display_ranges([DisplayPoint::new(DisplayRow(10), 0)
..DisplayPoint::new(DisplayRow(10), 0)])
});
@ -3378,7 +3378,7 @@ mod tests {
workspace
.update(cx, |_, window, cx| {
editor3.update(cx, |editor, cx| {
editor.change_selections(Default::default(), window, cx, |s| {
editor.change_selections(Some(Autoscroll::fit()), window, cx, |s| {
s.select_display_ranges([DisplayPoint::new(DisplayRow(12), 0)
..DisplayPoint::new(DisplayRow(12), 0)])
});
@ -3593,7 +3593,7 @@ mod tests {
workspace
.update(cx, |_, window, cx| {
editor1.update(cx, |editor, cx| {
editor.change_selections(SelectionEffects::no_scroll(), window, cx, |s| {
editor.change_selections(None, window, cx, |s| {
s.select_display_ranges([DisplayPoint::new(DisplayRow(15), 0)
..DisplayPoint::new(DisplayRow(15), 0)])
})
@ -3604,7 +3604,7 @@ mod tests {
workspace
.update(cx, |_, window, cx| {
editor1.update(cx, |editor, cx| {
editor.change_selections(SelectionEffects::no_scroll(), window, cx, |s| {
editor.change_selections(None, window, cx, |s| {
s.select_display_ranges([DisplayPoint::new(DisplayRow(3), 0)
..DisplayPoint::new(DisplayRow(3), 0)])
});
@ -3615,7 +3615,7 @@ mod tests {
workspace
.update(cx, |_, window, cx| {
editor1.update(cx, |editor, cx| {
editor.change_selections(SelectionEffects::no_scroll(), window, cx, |s| {
editor.change_selections(None, window, cx, |s| {
s.select_display_ranges([DisplayPoint::new(DisplayRow(13), 0)
..DisplayPoint::new(DisplayRow(13), 0)])
})
@ -3627,7 +3627,7 @@ mod tests {
.update(cx, |_, window, cx| {
editor1.update(cx, |editor, cx| {
editor.transact(window, cx, |editor, window, cx| {
editor.change_selections(SelectionEffects::no_scroll(), window, cx, |s| {
editor.change_selections(None, window, cx, |s| {
s.select_display_ranges([DisplayPoint::new(DisplayRow(2), 0)
..DisplayPoint::new(DisplayRow(14), 0)])
});
@ -3640,7 +3640,7 @@ mod tests {
workspace
.update(cx, |_, window, cx| {
editor1.update(cx, |editor, cx| {
editor.change_selections(SelectionEffects::no_scroll(), window, cx, |s| {
editor.change_selections(None, window, cx, |s| {
s.select_display_ranges([DisplayPoint::new(DisplayRow(1), 0)
..DisplayPoint::new(DisplayRow(1), 0)])
})