editor: Remove buffer and display map fields from SelectionsCollection (#42175)
Release Notes: - N/A *or* Added/Fixed/Improved ...
This commit is contained in:
@@ -38,7 +38,7 @@ impl Vim {
|
||||
.map(|s| s.to_vec())
|
||||
{
|
||||
editor.change_selections(Default::default(), window, cx, |s| {
|
||||
let map = s.display_map();
|
||||
let map = s.display_snapshot();
|
||||
s.select_display_ranges(selections.iter().map(|a| {
|
||||
let point = a.to_display_point(&map);
|
||||
point..point
|
||||
|
||||
@@ -682,8 +682,9 @@ pub fn register(editor: &mut Editor, cx: &mut Context<Vim>) {
|
||||
.disjoint_anchor_ranges()
|
||||
.collect::<Vec<_>>()
|
||||
});
|
||||
let snapshot = editor.buffer().read(cx).snapshot(cx);
|
||||
editor.change_selections(SelectionEffects::no_scroll(), window, cx, |s| {
|
||||
let end = Point::new(range.end.0, s.buffer().line_len(range.end));
|
||||
let end = Point::new(range.end.0, snapshot.line_len(range.end));
|
||||
s.select_ranges([end..Point::new(range.start.0, 0)]);
|
||||
});
|
||||
selections
|
||||
|
||||
@@ -120,8 +120,8 @@ impl Vim {
|
||||
|
||||
editor.edit(edits, cx);
|
||||
|
||||
let snapshot = editor.buffer().read(cx).snapshot(cx);
|
||||
editor.change_selections(Default::default(), window, cx, |s| {
|
||||
let snapshot = s.buffer().clone();
|
||||
s.select_ranges(new_selections.into_iter().map(|(anchor, len)| {
|
||||
let offset = anchor.to_offset(&snapshot);
|
||||
if action.before {
|
||||
|
||||
@@ -1210,7 +1210,7 @@ impl Vim {
|
||||
s.select_anchor_ranges(vec![pos..pos])
|
||||
}
|
||||
|
||||
let snapshot = s.display_map();
|
||||
let snapshot = s.display_snapshot();
|
||||
if let Some(pending) = s.pending_anchor_mut()
|
||||
&& pending.reversed
|
||||
&& mode.is_visual()
|
||||
|
||||
@@ -179,7 +179,7 @@ pub fn register(editor: &mut Editor, cx: &mut Context<Vim>) {
|
||||
vim.update_editor(cx, |_, editor, cx| {
|
||||
editor.set_clip_at_line_ends(false, cx);
|
||||
editor.change_selections(Default::default(), window, cx, |s| {
|
||||
let map = s.display_map();
|
||||
let map = s.display_snapshot();
|
||||
let ranges = ranges
|
||||
.into_iter()
|
||||
.map(|(start, end, reversed)| {
|
||||
@@ -304,7 +304,7 @@ impl Vim {
|
||||
) {
|
||||
let text_layout_details = editor.text_layout_details(window);
|
||||
editor.change_selections(Default::default(), window, cx, |s| {
|
||||
let map = &s.display_map();
|
||||
let map = &s.display_snapshot();
|
||||
let mut head = s.newest_anchor().head().to_display_point(map);
|
||||
let mut tail = s.oldest_anchor().tail().to_display_point(map);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user