Remove into SelectionEffects
from .change_selections
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
This commit is contained in:
parent
f338c46bf7
commit
28380d714d
65 changed files with 837 additions and 625 deletions
|
@ -7,7 +7,7 @@ use anyhow::Context as _;
|
|||
use collections::{HashMap, HashSet};
|
||||
use editor::{
|
||||
Anchor, Editor, EditorElement, EditorEvent, EditorSettings, EditorStyle, MAX_TAB_TITLE_LEN,
|
||||
MultiBuffer, actions::SelectAll, items::active_match_index, scroll::Autoscroll,
|
||||
MultiBuffer, SelectionEffects, actions::SelectAll, items::active_match_index,
|
||||
};
|
||||
use futures::{StreamExt, stream::FuturesOrdered};
|
||||
use gpui::{
|
||||
|
@ -1303,7 +1303,7 @@ impl ProjectSearchView {
|
|||
self.results_editor.update(cx, |editor, cx| {
|
||||
let range_to_select = editor.range_for_match(&range_to_select);
|
||||
editor.unfold_ranges(std::slice::from_ref(&range_to_select), false, true, cx);
|
||||
editor.change_selections(Some(Autoscroll::fit()), window, cx, |s| {
|
||||
editor.change_selections(Default::default(), window, cx, |s| {
|
||||
s.select_ranges([range_to_select])
|
||||
});
|
||||
});
|
||||
|
@ -1350,7 +1350,9 @@ impl ProjectSearchView {
|
|||
fn focus_results_editor(&mut self, window: &mut Window, cx: &mut Context<Self>) {
|
||||
self.query_editor.update(cx, |query_editor, cx| {
|
||||
let cursor = query_editor.selections.newest_anchor().head();
|
||||
query_editor.change_selections(None, window, cx, |s| s.select_ranges([cursor..cursor]));
|
||||
query_editor.change_selections(SelectionEffects::no_scroll(), window, cx, |s| {
|
||||
s.select_ranges([cursor..cursor])
|
||||
});
|
||||
});
|
||||
let results_handle = self.results_editor.focus_handle(cx);
|
||||
window.focus(&results_handle);
|
||||
|
@ -1370,7 +1372,7 @@ impl ProjectSearchView {
|
|||
let range_to_select = match_ranges
|
||||
.first()
|
||||
.map(|range| editor.range_for_match(range));
|
||||
editor.change_selections(Some(Autoscroll::fit()), window, cx, |s| {
|
||||
editor.change_selections(Default::default(), window, cx, |s| {
|
||||
s.select_ranges(range_to_select)
|
||||
});
|
||||
editor.scroll(Point::default(), Some(Axis::Vertical), window, cx);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue