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

@ -1,6 +1,6 @@
use crate::{Vim, motion::Motion, object::Object, state::Mode};
use collections::HashMap;
use editor::{Bias, Editor, RewrapOptions, SelectionEffects, display_map::ToDisplayPoint};
use editor::{Bias, Editor, RewrapOptions, display_map::ToDisplayPoint, scroll::Autoscroll};
use gpui::{Context, Window, actions};
use language::SelectionGoal;
@ -22,7 +22,7 @@ pub(crate) fn register(editor: &mut Editor, cx: &mut Context<Vim>) {
},
cx,
);
editor.change_selections(Default::default(), window, cx, |s| {
editor.change_selections(Some(Autoscroll::fit()), window, cx, |s| {
s.move_with(|map, selection| {
if let Some(anchor) = positions.remove(&selection.id) {
let mut point = anchor.to_display_point(map);
@ -53,7 +53,7 @@ impl Vim {
let text_layout_details = editor.text_layout_details(window);
editor.transact(window, cx, |editor, window, cx| {
let mut selection_starts: HashMap<_, _> = Default::default();
editor.change_selections(SelectionEffects::no_scroll(), window, cx, |s| {
editor.change_selections(None, window, cx, |s| {
s.move_with(|map, selection| {
let anchor = map.display_point_to_anchor(selection.head(), Bias::Right);
selection_starts.insert(selection.id, anchor);
@ -73,7 +73,7 @@ impl Vim {
},
cx,
);
editor.change_selections(SelectionEffects::no_scroll(), window, cx, |s| {
editor.change_selections(None, window, cx, |s| {
s.move_with(|map, selection| {
let anchor = selection_starts.remove(&selection.id).unwrap();
let mut point = anchor.to_display_point(map);
@ -96,7 +96,7 @@ impl Vim {
self.update_editor(window, cx, |_, editor, window, cx| {
editor.transact(window, cx, |editor, window, cx| {
let mut original_positions: HashMap<_, _> = Default::default();
editor.change_selections(SelectionEffects::no_scroll(), window, cx, |s| {
editor.change_selections(None, window, cx, |s| {
s.move_with(|map, selection| {
let anchor = map.display_point_to_anchor(selection.head(), Bias::Right);
original_positions.insert(selection.id, anchor);
@ -110,7 +110,7 @@ impl Vim {
},
cx,
);
editor.change_selections(SelectionEffects::no_scroll(), window, cx, |s| {
editor.change_selections(None, window, cx, |s| {
s.move_with(|map, selection| {
let anchor = original_positions.remove(&selection.id).unwrap();
let mut point = anchor.to_display_point(map);