Revert "Remove into SelectionEffects
from .change_selections"
This reverts commit 28380d714d
.
This commit is contained in:
parent
28380d714d
commit
6e762d9c05
65 changed files with 625 additions and 837 deletions
|
@ -1540,10 +1540,7 @@ mod tests {
|
|||
use std::ops::Range;
|
||||
|
||||
use super::*;
|
||||
use editor::{
|
||||
DisplayPoint, Editor, MultiBuffer, SearchSettings, SelectionEffects,
|
||||
display_map::DisplayRow,
|
||||
};
|
||||
use editor::{DisplayPoint, Editor, MultiBuffer, SearchSettings, display_map::DisplayRow};
|
||||
use gpui::{Hsla, TestAppContext, UpdateGlobal, VisualTestContext};
|
||||
use language::{Buffer, Point};
|
||||
use project::Project;
|
||||
|
@ -1680,7 +1677,7 @@ mod tests {
|
|||
});
|
||||
|
||||
editor.update_in(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(0), 0)..DisplayPoint::new(DisplayRow(0), 0)
|
||||
])
|
||||
|
@ -1767,7 +1764,7 @@ mod tests {
|
|||
// Park the cursor in between matches and ensure that going to the previous match selects
|
||||
// the closest match to the left.
|
||||
editor.update_in(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(1), 0)..DisplayPoint::new(DisplayRow(1), 0)
|
||||
])
|
||||
|
@ -1788,7 +1785,7 @@ mod tests {
|
|||
// Park the cursor in between matches and ensure that going to the next match selects the
|
||||
// closest match to the right.
|
||||
editor.update_in(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(1), 0)..DisplayPoint::new(DisplayRow(1), 0)
|
||||
])
|
||||
|
@ -1809,7 +1806,7 @@ mod tests {
|
|||
// Park the cursor after the last match and ensure that going to the previous match selects
|
||||
// the last match.
|
||||
editor.update_in(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(3), 60)..DisplayPoint::new(DisplayRow(3), 60)
|
||||
])
|
||||
|
@ -1830,7 +1827,7 @@ mod tests {
|
|||
// Park the cursor after the last match and ensure that going to the next match selects the
|
||||
// first match.
|
||||
editor.update_in(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(3), 60)..DisplayPoint::new(DisplayRow(3), 60)
|
||||
])
|
||||
|
@ -1851,7 +1848,7 @@ mod tests {
|
|||
// Park the cursor before the first match and ensure that going to the previous match
|
||||
// selects the last match.
|
||||
editor.update_in(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(0), 0)..DisplayPoint::new(DisplayRow(0), 0)
|
||||
])
|
||||
|
@ -2628,7 +2625,7 @@ mod tests {
|
|||
});
|
||||
|
||||
editor.update_in(cx, |editor, window, cx| {
|
||||
editor.change_selections(SelectionEffects::no_scroll(), window, cx, |s| {
|
||||
editor.change_selections(None, window, cx, |s| {
|
||||
s.select_ranges(vec![Point::new(1, 0)..Point::new(2, 4)])
|
||||
})
|
||||
});
|
||||
|
@ -2711,7 +2708,7 @@ mod tests {
|
|||
});
|
||||
|
||||
editor.update_in(cx, |editor, window, cx| {
|
||||
editor.change_selections(SelectionEffects::no_scroll(), window, cx, |s| {
|
||||
editor.change_selections(None, window, cx, |s| {
|
||||
s.select_ranges(vec![
|
||||
Point::new(1, 0)..Point::new(1, 4),
|
||||
Point::new(5, 3)..Point::new(6, 4),
|
||||
|
|
|
@ -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, SelectionEffects, actions::SelectAll, items::active_match_index,
|
||||
MultiBuffer, actions::SelectAll, items::active_match_index, scroll::Autoscroll,
|
||||
};
|
||||
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(Default::default(), window, cx, |s| {
|
||||
editor.change_selections(Some(Autoscroll::fit()), window, cx, |s| {
|
||||
s.select_ranges([range_to_select])
|
||||
});
|
||||
});
|
||||
|
@ -1350,9 +1350,7 @@ 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(SelectionEffects::no_scroll(), window, cx, |s| {
|
||||
s.select_ranges([cursor..cursor])
|
||||
});
|
||||
query_editor.change_selections(None, window, cx, |s| s.select_ranges([cursor..cursor]));
|
||||
});
|
||||
let results_handle = self.results_editor.focus_handle(cx);
|
||||
window.focus(&results_handle);
|
||||
|
@ -1372,7 +1370,7 @@ impl ProjectSearchView {
|
|||
let range_to_select = match_ranges
|
||||
.first()
|
||||
.map(|range| editor.range_for_match(range));
|
||||
editor.change_selections(Default::default(), window, cx, |s| {
|
||||
editor.change_selections(Some(Autoscroll::fit()), 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