Remove into SelectionEffects
from .change_selections (#33554)
In #32656 I generalized the argument to change selections to allow controling both the scroll and the nav history (and the completion trigger). To avoid conflicting with ongoing debugger cherry-picks I left the argument as an `impl Into<>`, but I think it's clearer to make callers specify what they want here. I converted a lot of `None` arguments to `SelectionEffects::no_scroll()` to be exactly compatible; but I think many people used none as an "i don't care" value in which case Default::default() might be more appropraite Closes #ISSUE Release Notes: - N/A
This commit is contained in:
parent
6e762d9c05
commit
a675ca7a1e
65 changed files with 837 additions and 625 deletions
|
@ -1,6 +1,6 @@
|
|||
use crate::{Vim, motion::Motion, object::Object, state::Mode};
|
||||
use collections::HashMap;
|
||||
use editor::{Bias, Editor, RewrapOptions, display_map::ToDisplayPoint, scroll::Autoscroll};
|
||||
use editor::{Bias, Editor, RewrapOptions, SelectionEffects, display_map::ToDisplayPoint};
|
||||
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(Some(Autoscroll::fit()), window, cx, |s| {
|
||||
editor.change_selections(Default::default(), 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(None, window, cx, |s| {
|
||||
editor.change_selections(SelectionEffects::no_scroll(), 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(None, window, cx, |s| {
|
||||
editor.change_selections(SelectionEffects::no_scroll(), 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(None, window, cx, |s| {
|
||||
editor.change_selections(SelectionEffects::no_scroll(), 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(None, window, cx, |s| {
|
||||
editor.change_selections(SelectionEffects::no_scroll(), window, cx, |s| {
|
||||
s.move_with(|map, selection| {
|
||||
let anchor = original_positions.remove(&selection.id).unwrap();
|
||||
let mut point = anchor.to_display_point(map);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue