editor: Fix unwrap_syntax_node panicking by not setting selections (#38329)
Fixes ZED-11T Release Notes: - N/A *or* Added/Fixed/Improved ...
This commit is contained in:
@@ -463,7 +463,7 @@ pub fn register(editor: &mut Editor, cx: &mut Context<Vim>) {
|
||||
.collect();
|
||||
vim.switch_mode(Mode::Normal, true, window, cx);
|
||||
let initial_selections =
|
||||
vim.update_editor(cx, |_, editor, _| editor.selections.disjoint_anchors());
|
||||
vim.update_editor(cx, |_, editor, _| editor.selections.disjoint_anchors_arc());
|
||||
if let Some(range) = &action.range {
|
||||
let result = vim.update_editor(cx, |vim, editor, cx| {
|
||||
let range = range.buffer_range(vim, editor, window, cx)?;
|
||||
@@ -515,7 +515,7 @@ pub fn register(editor: &mut Editor, cx: &mut Context<Vim>) {
|
||||
.buffer()
|
||||
.update(cx, |multi, cx| multi.last_transaction_id(cx))
|
||||
{
|
||||
let last_sel = editor.selections.disjoint_anchors();
|
||||
let last_sel = editor.selections.disjoint_anchors_arc();
|
||||
editor.modify_transaction_selection_history(tx_id, |old| {
|
||||
old.0 = first_sel;
|
||||
old.1 = Some(last_sel);
|
||||
|
||||
@@ -22,7 +22,7 @@ impl Vim {
|
||||
self.update_editor(cx, |vim, editor, cx| {
|
||||
let anchors = editor
|
||||
.selections
|
||||
.disjoint_anchors()
|
||||
.disjoint_anchors_arc()
|
||||
.iter()
|
||||
.map(|s| s.head())
|
||||
.collect::<Vec<_>>();
|
||||
|
||||
@@ -326,7 +326,7 @@ impl Vim {
|
||||
|
||||
let stable_anchors = editor
|
||||
.selections
|
||||
.disjoint_anchors()
|
||||
.disjoint_anchors_arc()
|
||||
.iter()
|
||||
.map(|selection| {
|
||||
let start = selection.start.bias_left(&display_map.buffer_snapshot);
|
||||
|
||||
@@ -1075,16 +1075,16 @@ impl Vim {
|
||||
}
|
||||
|
||||
let snapshot = s.display_map();
|
||||
if let Some(pending) = s.pending.as_mut()
|
||||
&& pending.selection.reversed
|
||||
if let Some(pending) = s.pending_anchor_mut()
|
||||
&& pending.reversed
|
||||
&& mode.is_visual()
|
||||
&& !last_mode.is_visual()
|
||||
{
|
||||
let mut end = pending.selection.end.to_point(&snapshot.buffer_snapshot);
|
||||
let mut end = pending.end.to_point(&snapshot.buffer_snapshot);
|
||||
end = snapshot
|
||||
.buffer_snapshot
|
||||
.clip_point(end + Point::new(0, 1), Bias::Right);
|
||||
pending.selection.end = snapshot.buffer_snapshot.anchor_before(end);
|
||||
pending.end = snapshot.buffer_snapshot.anchor_before(end);
|
||||
}
|
||||
|
||||
s.move_with(|map, selection| {
|
||||
@@ -1332,7 +1332,7 @@ impl Vim {
|
||||
self.update_editor(cx, |_, editor, _| {
|
||||
editor
|
||||
.selections
|
||||
.disjoint_anchors()
|
||||
.disjoint_anchors_arc()
|
||||
.iter()
|
||||
.map(|selection| selection.tail()..selection.head())
|
||||
.collect()
|
||||
|
||||
@@ -748,7 +748,7 @@ impl Vim {
|
||||
// after the change
|
||||
let stable_anchors = editor
|
||||
.selections
|
||||
.disjoint_anchors()
|
||||
.disjoint_anchors_arc()
|
||||
.iter()
|
||||
.map(|selection| {
|
||||
let start = selection.start.bias_left(&display_map.buffer_snapshot);
|
||||
|
||||
Reference in New Issue
Block a user