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:
Lukas Wirth
2025-09-17 15:10:05 +00:00
committed by GitHub
parent 0f6dd84c98
commit f3b8c619e3
16 changed files with 112 additions and 85 deletions
+2 -2
View File
@@ -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);