Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
Remove unnecessary argument from Vim#update_editor (#36001)
Conrad Irwinadd67bde43ae
diff --git a/crates/vim/src/change_list.rs b/crates/vim/src/change_list.rsindex a59083f7aba..c92ce4720e8 100644--- a/crates/vim/src/change_list.rs+++ b/crates/vim/src/change_list.rs@@ -31,7 +31,7 @@ impl Vim {) {let count = Vim::take_count(cx).unwrap_or(1);Vim::take_forced_motion(cx);- self.update_editor(window, cx, |_, editor, window, cx| {+ self.update_editor(cx, |_, editor, cx| {if let Some(selections) = editor.change_list.next_change(count, direction)@@ -49,7 +49,7 @@ impl Vim {}pub(crate) fn push_to_change_list(&mut self, window: &mut Window, cx: &mut Context<Self>) {- let Some((new_positions, buffer)) = self.update_editor(window, cx, |vim, editor, _, cx| {+ let Some((new_positions, buffer)) = self.update_editor(cx, |vim, editor, cx| {let (map, selections) = editor.selections.all_adjusted_display(cx);let buffer = editor.buffer().clone();diff --git a/crates/vim/src/command.rs b/crates/vim/src/command.rsindex 7963db35712..f7889d8cd83 100644--- a/crates/vim/src/command.rs+++ b/crates/vim/src/command.rs@@ -241,9 +241,9 @@ impl Deref for WrappedAction {pub fn register(editor: &mut Editor, cx: &mut Context<Vim>) {// Vim::action(editor, cx, |vim, action: &StartOfLine, window, cx| {- Vim::action(editor, cx, |vim, action: &VimSet, window, cx| {+ Vim::action(editor, cx, |vim, action: &VimSet, _, cx| {for option in action.options.iter() {- vim.update_editor(window, cx, |_, editor, _, cx| match option {+ vim.update_editor(cx, |_, editor, cx| match option {VimOption::Wrap(true) => {editor.set_soft_wrap_mode(language::language_settings::SoftWrap::EditorWidth, cx);@@ -298,7 +298,7 @@ pub fn register(editor: &mut Editor, cx: &mut Context<Vim>) {});Vim::action(editor, cx, |vim, action: &VimSave, window, cx| {- vim.update_editor(window, cx, |_, editor, window, cx| {+ vim.update_editor(cx, |_, editor, cx| {let Some(project) = editor.project.clone() else {return;};@@ -375,7 +375,7 @@ pub fn register(editor: &mut Editor, cx: &mut Context<Vim>) {cx,);}- vim.update_editor(window, cx, |vim, editor, window, cx| match action {+ vim.update_editor(cx, |vim, editor, cx| match action {DeleteMarks::Marks(s) => {if s.starts_with('-') || s.ends_with('-') || s.contains(['\'', '`']) {err(s.clone(), window, cx);@@ -432,7 +432,7 @@ pub fn register(editor: &mut Editor, cx: &mut Context<Vim>) {});Vim::action(editor, cx, |vim, action: &VimEdit, window, cx| {- vim.update_editor(window, cx, |vim, editor, window, cx| {+ vim.update_editor(cx, |vim, editor, cx| {let Some(workspace) = vim.workspace(window) else {return;};@@ -462,11 +462,10 @@ pub fn register(editor: &mut Editor, cx: &mut Context<Vim>) {.map(|c| Keystroke::parse(&c.to_string()).unwrap()).collect();vim.switch_mode(Mode::Normal, true, window, cx);- let initial_selections = vim.update_editor(window, cx, |_, editor, _, _| {- editor.selections.disjoint_anchors()- });+ let initial_selections =+ vim.update_editor(cx, |_, editor, _| editor.selections.disjoint_anchors());if let Some(range) = &action.range {- let result = vim.update_editor(window, cx, |vim, editor, window, cx| {+ let result = vim.update_editor(cx, |vim, editor, cx| {let range = range.buffer_range(vim, editor, window, cx)?;editor.change_selections(SelectionEffects::no_scroll().nav_history(false),@@ -498,7 +497,7 @@ pub fn register(editor: &mut Editor, cx: &mut Context<Vim>) {cx.spawn_in(window, async move |vim, cx| {task.await;vim.update_in(cx, |vim, window, cx| {- vim.update_editor(window, cx, |_, editor, window, cx| {+ vim.update_editor(cx, |_, editor, cx| {if had_range {editor.change_selections(SelectionEffects::default(), window, cx, |s| {s.select_anchor_ranges([s.newest_anchor().range()]);@@ -510,7 +509,7 @@ pub fn register(editor: &mut Editor, cx: &mut Context<Vim>) {} else {vim.switch_mode(Mode::Normal, true, window, cx);}- vim.update_editor(window, cx, |_, editor, _, cx| {+ vim.update_editor(cx, |_, editor, cx| {if let Some(first_sel) = initial_selections {if let Some(tx_id) = editor.buffer()@@ -548,7 +547,7 @@ pub fn register(editor: &mut Editor, cx: &mut Context<Vim>) {Vim::action(editor, cx, |vim, action: &GoToLine, window, cx| {vim.switch_mode(Mode::Normal, false, window, cx);- let result = vim.update_editor(window, cx, |vim, editor, window, cx| {+ let result = vim.update_editor(cx, |vim, editor, cx| {let snapshot = editor.snapshot(window, cx);let buffer_row = action.range.head().buffer_row(vim, editor, window, cx)?;let current = editor.selections.newest::<Point>(cx);@@ -573,7 +572,7 @@ pub fn register(editor: &mut Editor, cx: &mut Context<Vim>) {});Vim::action(editor, cx, |vim, action: &YankCommand, window, cx| {- vim.update_editor(window, cx, |vim, editor, window, cx| {+ vim.update_editor(cx, |vim, editor, cx| {let snapshot = editor.snapshot(window, cx);if let Ok(range) = action.range.buffer_range(vim, editor, window, cx) {let end = if range.end < snapshot.buffer_snapshot.max_row() {@@ -600,7 +599,7 @@ pub fn register(editor: &mut Editor, cx: &mut Context<Vim>) {});Vim::action(editor, cx, |vim, action: &WithRange, window, cx| {- let result = vim.update_editor(window, cx, |vim, editor, window, cx| {+ let result = vim.update_editor(cx, |vim, editor, cx| {action.range.buffer_range(vim, editor, window, cx)});@@ -619,7 +618,7 @@ pub fn register(editor: &mut Editor, cx: &mut Context<Vim>) {};let previous_selections = vim- .update_editor(window, cx, |_, editor, window, cx| {+ .update_editor(cx, |_, editor, cx| {let selections = action.restore_selection.then(|| {editor.selections@@ -635,7 +634,7 @@ pub fn register(editor: &mut Editor, cx: &mut Context<Vim>) {.flatten();window.dispatch_action(action.action.boxed_clone(), cx);cx.defer_in(window, move |vim, window, cx| {- vim.update_editor(window, cx, |_, editor, window, cx| {+ vim.update_editor(cx, |_, editor, cx| {editor.change_selections(SelectionEffects::no_scroll(), window, cx, |s| {if let Some(previous_selections) = previous_selections {s.select_ranges(previous_selections);@@ -1536,7 +1535,7 @@ impl OnMatchingLines {}pub fn run(&self, vim: &mut Vim, window: &mut Window, cx: &mut Context<Vim>) {- let result = vim.update_editor(window, cx, |vim, editor, window, cx| {+ let result = vim.update_editor(cx, |vim, editor, cx| {self.range.buffer_range(vim, editor, window, cx)});@@ -1600,7 +1599,7 @@ impl OnMatchingLines {});};- vim.update_editor(window, cx, |_, editor, window, cx| {+ vim.update_editor(cx, |_, editor, cx| {let snapshot = editor.snapshot(window, cx);let mut row = range.start.0;@@ -1680,7 +1679,7 @@ pub struct ShellExec {impl Vim {pub fn cancel_running_command(&mut self, window: &mut Window, cx: &mut Context<Self>) {if self.running_command.take().is_some() {- self.update_editor(window, cx, |_, editor, window, cx| {+ self.update_editor(cx, |_, editor, cx| {editor.transact(window, cx, |editor, _window, _cx| {editor.clear_row_highlights::<ShellExec>();})@@ -1691,7 +1690,7 @@ impl Vim {fn prepare_shell_command(&mut self,command: &str,- window: &mut Window,+ _: &mut Window,cx: &mut Context<Self>,) -> String {let mut ret = String::new();@@ -1711,7 +1710,7 @@ impl Vim {}match c {'%' => {- self.update_editor(window, cx, |_, editor, _window, cx| {+ self.update_editor(cx, |_, editor, cx| {if let Some((_, buffer, _)) = editor.active_excerpt(cx) {if let Some(file) = buffer.read(cx).file() {if let Some(local) = file.as_local() {@@ -1747,7 +1746,7 @@ impl Vim {let Some(workspace) = self.workspace(window) else {return;};- let command = self.update_editor(window, cx, |_, editor, window, cx| {+ let command = self.update_editor(cx, |_, editor, cx| {let snapshot = editor.snapshot(window, cx);let start = editor.selections.newest_display(cx);let text_layout_details = editor.text_layout_details(window);@@ -1794,7 +1793,7 @@ impl Vim {let Some(workspace) = self.workspace(window) else {return;};- let command = self.update_editor(window, cx, |_, editor, window, cx| {+ let command = self.update_editor(cx, |_, editor, cx| {let snapshot = editor.snapshot(window, cx);let start = editor.selections.newest_display(cx);let range = object@@ -1896,7 +1895,7 @@ impl ShellExec {let mut input_snapshot = None;let mut input_range = None;let mut needs_newline_prefix = false;- vim.update_editor(window, cx, |vim, editor, window, cx| {+ vim.update_editor(cx, |vim, editor, cx| {let snapshot = editor.buffer().read(cx).snapshot(cx);let range = if let Some(range) = self.range.clone() {let Some(range) = range.buffer_range(vim, editor, window, cx).log_err() else {@@ -1990,7 +1989,7 @@ impl ShellExec {}vim.update_in(cx, |vim, window, cx| {- vim.update_editor(window, cx, |_, editor, window, cx| {+ vim.update_editor(cx, |_, editor, cx| {editor.transact(window, cx, |editor, window, cx| {editor.edit([(range.clone(), text)], cx);let snapshot = editor.buffer().read(cx).snapshot(cx);diff --git a/crates/vim/src/digraph.rs b/crates/vim/src/digraph.rsindex 881454392ac..c555b781b1e 100644--- a/crates/vim/src/digraph.rs+++ b/crates/vim/src/digraph.rs@@ -56,9 +56,7 @@ impl Vim {self.pop_operator(window, cx);if self.editor_input_enabled() {- self.update_editor(window, cx, |_, editor, window, cx| {- editor.insert(&text, window, cx)- });+ self.update_editor(cx, |_, editor, cx| editor.insert(&text, window, cx));} else {self.input_ignored(text, window, cx);}@@ -214,9 +212,7 @@ impl Vim {text.push_str(suffix);if self.editor_input_enabled() {- self.update_editor(window, cx, |_, editor, window, cx| {- editor.insert(&text, window, cx)- });+ self.update_editor(cx, |_, editor, cx| editor.insert(&text, window, cx));} else {self.input_ignored(text.into(), window, cx);}diff --git a/crates/vim/src/helix.rs b/crates/vim/src/helix.rsindex ca93c9c1de0..686c74f65e9 100644--- a/crates/vim/src/helix.rs+++ b/crates/vim/src/helix.rs@@ -62,7 +62,7 @@ impl Vim {cx: &mut Context<Self>,mut is_boundary: impl FnMut(char, char, &CharClassifier) -> bool,) {- self.update_editor(window, cx, |_, editor, window, cx| {+ self.update_editor(cx, |_, editor, cx| {editor.change_selections(Default::default(), window, cx, |s| {s.move_with(|map, selection| {let times = times.unwrap_or(1);@@ -115,7 +115,7 @@ impl Vim {cx: &mut Context<Self>,mut is_boundary: impl FnMut(char, char, &CharClassifier) -> bool,) {- self.update_editor(window, cx, |_, editor, window, cx| {+ self.update_editor(cx, |_, editor, cx| {editor.change_selections(Default::default(), window, cx, |s| {s.move_with(|map, selection| {let times = times.unwrap_or(1);@@ -175,7 +175,7 @@ impl Vim {window: &mut Window,cx: &mut Context<Self>,) {- self.update_editor(window, cx, |_, editor, window, cx| {+ self.update_editor(cx, |_, editor, cx| {let text_layout_details = editor.text_layout_details(window);editor.change_selections(Default::default(), window, cx, |s| {s.move_with(|map, selection| {@@ -253,7 +253,7 @@ impl Vim {})}Motion::FindForward { .. } => {- self.update_editor(window, cx, |_, editor, window, cx| {+ self.update_editor(cx, |_, editor, cx| {let text_layout_details = editor.text_layout_details(window);editor.change_selections(Default::default(), window, cx, |s| {s.move_with(|map, selection| {@@ -280,7 +280,7 @@ impl Vim {});}Motion::FindBackward { .. } => {- self.update_editor(window, cx, |_, editor, window, cx| {+ self.update_editor(cx, |_, editor, cx| {let text_layout_details = editor.text_layout_details(window);editor.change_selections(Default::default(), window, cx, |s| {s.move_with(|map, selection| {@@ -312,7 +312,7 @@ impl Vim {fn helix_insert(&mut self, _: &HelixInsert, window: &mut Window, cx: &mut Context<Self>) {self.start_recording(cx);- self.update_editor(window, cx, |_, editor, window, cx| {+ self.update_editor(cx, |_, editor, cx| {editor.change_selections(Default::default(), window, cx, |s| {s.move_with(|_map, selection| {// In helix normal mode, move cursor to start of selection and collapse@@ -328,7 +328,7 @@ impl Vim {fn helix_append(&mut self, _: &HelixAppend, window: &mut Window, cx: &mut Context<Self>) {self.start_recording(cx);self.switch_mode(Mode::Insert, false, window, cx);- self.update_editor(window, cx, |_, editor, window, cx| {+ self.update_editor(cx, |_, editor, cx| {editor.change_selections(Default::default(), window, cx, |s| {s.move_with(|map, selection| {let point = if selection.is_empty() {@@ -343,7 +343,7 @@ impl Vim {}pub fn helix_replace(&mut self, text: &str, window: &mut Window, cx: &mut Context<Self>) {- self.update_editor(window, cx, |_, editor, window, cx| {+ self.update_editor(cx, |_, editor, cx| {editor.transact(window, cx, |editor, window, cx| {let (map, selections) = editor.selections.all_display(cx);diff --git a/crates/vim/src/indent.rs b/crates/vim/src/indent.rsindex 75b1857a5b9..7ef204de0f6 100644--- a/crates/vim/src/indent.rs+++ b/crates/vim/src/indent.rs@@ -31,7 +31,7 @@ pub(crate) fn register(editor: &mut Editor, cx: &mut Context<Vim>) {let count = Vim::take_count(cx).unwrap_or(1);Vim::take_forced_motion(cx);vim.store_visual_marks(window, cx);- vim.update_editor(window, cx, |vim, editor, window, cx| {+ vim.update_editor(cx, |vim, editor, cx| {editor.transact(window, cx, |editor, window, cx| {let original_positions = vim.save_selection_starts(editor, cx);for _ in 0..count {@@ -50,7 +50,7 @@ pub(crate) fn register(editor: &mut Editor, cx: &mut Context<Vim>) {let count = Vim::take_count(cx).unwrap_or(1);Vim::take_forced_motion(cx);vim.store_visual_marks(window, cx);- vim.update_editor(window, cx, |vim, editor, window, cx| {+ vim.update_editor(cx, |vim, editor, cx| {editor.transact(window, cx, |editor, window, cx| {let original_positions = vim.save_selection_starts(editor, cx);for _ in 0..count {@@ -69,7 +69,7 @@ pub(crate) fn register(editor: &mut Editor, cx: &mut Context<Vim>) {let count = Vim::take_count(cx).unwrap_or(1);Vim::take_forced_motion(cx);vim.store_visual_marks(window, cx);- vim.update_editor(window, cx, |vim, editor, window, cx| {+ vim.update_editor(cx, |vim, editor, cx| {editor.transact(window, cx, |editor, window, cx| {let original_positions = vim.save_selection_starts(editor, cx);for _ in 0..count {@@ -95,7 +95,7 @@ impl Vim {cx: &mut Context<Self>,) {self.stop_recording(cx);- self.update_editor(window, cx, |_, editor, window, cx| {+ self.update_editor(cx, |_, editor, cx| {let text_layout_details = editor.text_layout_details(window);editor.transact(window, cx, |editor, window, cx| {let mut selection_starts: HashMap<_, _> = Default::default();@@ -137,7 +137,7 @@ impl Vim {cx: &mut Context<Self>,) {self.stop_recording(cx);- self.update_editor(window, cx, |_, editor, window, cx| {+ self.update_editor(cx, |_, editor, cx| {editor.transact(window, cx, |editor, window, cx| {let mut original_positions: HashMap<_, _> = Default::default();editor.change_selections(SelectionEffects::no_scroll(), window, cx, |s| {diff --git a/crates/vim/src/insert.rs b/crates/vim/src/insert.rsindex 0a370e16ba4..584057a8c0f 100644--- a/crates/vim/src/insert.rs+++ b/crates/vim/src/insert.rs@@ -38,7 +38,7 @@ impl Vim {if count <= 1 || Vim::globals(cx).dot_replaying {self.create_mark("^".into(), window, cx);- self.update_editor(window, cx, |_, editor, window, cx| {+ self.update_editor(cx, |_, editor, cx| {editor.dismiss_menus_and_popups(false, window, cx);if !HelixModeSetting::get_global(cx).0 {diff --git a/crates/vim/src/motion.rs b/crates/vim/src/motion.rsindex 0e487f44104..7ef883f4061 100644--- a/crates/vim/src/motion.rs+++ b/crates/vim/src/motion.rs@@ -679,7 +679,7 @@ impl Vim {match self.mode {Mode::Visual | Mode::VisualLine | Mode::VisualBlock => {if !prior_selections.is_empty() {- self.update_editor(window, cx, |_, editor, window, cx| {+ self.update_editor(cx, |_, editor, cx| {editor.change_selections(Default::default(), window, cx, |s| {s.select_ranges(prior_selections.iter().cloned())})diff --git a/crates/vim/src/normal.rs b/crates/vim/src/normal.rsindex 13128e7b403..b74d85b7c58 100644--- a/crates/vim/src/normal.rs+++ b/crates/vim/src/normal.rs@@ -132,7 +132,7 @@ pub(crate) fn register(editor: &mut Editor, cx: &mut Context<Vim>) {Vim::action(editor, cx, |vim, _: &HelixDelete, window, cx| {vim.record_current_action(cx);- vim.update_editor(window, cx, |_, editor, window, cx| {+ vim.update_editor(cx, |_, editor, cx| {editor.change_selections(SelectionEffects::no_scroll(), window, cx, |s| {s.move_with(|map, selection| {if selection.is_empty() {@@ -146,7 +146,7 @@ pub(crate) fn register(editor: &mut Editor, cx: &mut Context<Vim>) {});Vim::action(editor, cx, |vim, _: &HelixCollapseSelection, window, cx| {- vim.update_editor(window, cx, |_, editor, window, cx| {+ vim.update_editor(cx, |_, editor, cx| {editor.change_selections(SelectionEffects::no_scroll(), window, cx, |s| {s.move_with(|map, selection| {let mut point = selection.head();@@ -198,7 +198,7 @@ pub(crate) fn register(editor: &mut Editor, cx: &mut Context<Vim>) {Vim::action(editor, cx, |vim, _: &Undo, window, cx| {let times = Vim::take_count(cx);Vim::take_forced_motion(cx);- vim.update_editor(window, cx, |_, editor, window, cx| {+ vim.update_editor(cx, |_, editor, cx| {for _ in 0..times.unwrap_or(1) {editor.undo(&editor::actions::Undo, window, cx);}@@ -207,7 +207,7 @@ pub(crate) fn register(editor: &mut Editor, cx: &mut Context<Vim>) {Vim::action(editor, cx, |vim, _: &Redo, window, cx| {let times = Vim::take_count(cx);Vim::take_forced_motion(cx);- vim.update_editor(window, cx, |_, editor, window, cx| {+ vim.update_editor(cx, |_, editor, cx| {for _ in 0..times.unwrap_or(1) {editor.redo(&editor::actions::Redo, window, cx);}@@ -215,7 +215,7 @@ pub(crate) fn register(editor: &mut Editor, cx: &mut Context<Vim>) {});Vim::action(editor, cx, |vim, _: &UndoLastLine, window, cx| {Vim::take_forced_motion(cx);- vim.update_editor(window, cx, |vim, editor, window, cx| {+ vim.update_editor(cx, |vim, editor, cx| {let snapshot = editor.buffer().read(cx).snapshot(cx);let Some(last_change) = editor.change_list.last_before_grouping() else {return;@@ -526,7 +526,7 @@ impl Vim {window: &mut Window,cx: &mut Context<Self>,) {- self.update_editor(window, cx, |_, editor, window, cx| {+ self.update_editor(cx, |_, editor, cx| {let text_layout_details = editor.text_layout_details(window);editor.change_selections(SelectionEffects::default().nav_history(motion.push_to_jump_list()),@@ -546,7 +546,7 @@ impl Vim {fn insert_after(&mut self, _: &InsertAfter, window: &mut Window, cx: &mut Context<Self>) {self.start_recording(cx);self.switch_mode(Mode::Insert, false, window, cx);- self.update_editor(window, cx, |_, editor, window, cx| {+ self.update_editor(cx, |_, editor, cx| {editor.change_selections(Default::default(), window, cx, |s| {s.move_cursors_with(|map, cursor, _| (right(map, cursor, 1), SelectionGoal::None));});@@ -557,7 +557,7 @@ impl Vim {self.start_recording(cx);if self.mode.is_visual() {let current_mode = self.mode;- self.update_editor(window, cx, |_, editor, window, cx| {+ self.update_editor(cx, |_, editor, cx| {editor.change_selections(Default::default(), window, cx, |s| {s.move_with(|map, selection| {if current_mode == Mode::VisualLine {@@ -581,7 +581,7 @@ impl Vim {) {self.start_recording(cx);self.switch_mode(Mode::Insert, false, window, cx);- self.update_editor(window, cx, |_, editor, window, cx| {+ self.update_editor(cx, |_, editor, cx| {editor.change_selections(Default::default(), window, cx, |s| {s.move_cursors_with(|map, cursor, _| {(@@ -601,7 +601,7 @@ impl Vim {) {self.start_recording(cx);self.switch_mode(Mode::Insert, false, window, cx);- self.update_editor(window, cx, |_, editor, window, cx| {+ self.update_editor(cx, |_, editor, cx| {editor.change_selections(Default::default(), window, cx, |s| {s.move_cursors_with(|map, cursor, _| {(next_line_end(map, cursor, 1), SelectionGoal::None)@@ -618,7 +618,7 @@ impl Vim {) {self.start_recording(cx);self.switch_mode(Mode::Insert, false, window, cx);- self.update_editor(window, cx, |vim, editor, window, cx| {+ self.update_editor(cx, |vim, editor, cx| {let Some(Mark::Local(marks)) = vim.get_mark("^", editor, window, cx) else {return;};@@ -637,7 +637,7 @@ impl Vim {) {self.start_recording(cx);self.switch_mode(Mode::Insert, false, window, cx);- self.update_editor(window, cx, |_, editor, window, cx| {+ self.update_editor(cx, |_, editor, cx| {editor.transact(window, cx, |editor, window, cx| {let selections = editor.selections.all::<Point>(cx);let snapshot = editor.buffer().read(cx).snapshot(cx);@@ -678,7 +678,7 @@ impl Vim {) {self.start_recording(cx);self.switch_mode(Mode::Insert, false, window, cx);- self.update_editor(window, cx, |_, editor, window, cx| {+ self.update_editor(cx, |_, editor, cx| {let text_layout_details = editor.text_layout_details(window);editor.transact(window, cx, |editor, window, cx| {let selections = editor.selections.all::<Point>(cx);@@ -725,7 +725,7 @@ impl Vim {self.record_current_action(cx);let count = Vim::take_count(cx).unwrap_or(1);Vim::take_forced_motion(cx);- self.update_editor(window, cx, |_, editor, window, cx| {+ self.update_editor(cx, |_, editor, cx| {editor.transact(window, cx, |editor, _, cx| {let selections = editor.selections.all::<Point>(cx);@@ -754,7 +754,7 @@ impl Vim {self.record_current_action(cx);let count = Vim::take_count(cx).unwrap_or(1);Vim::take_forced_motion(cx);- self.update_editor(window, cx, |_, editor, window, cx| {+ self.update_editor(cx, |_, editor, cx| {editor.transact(window, cx, |editor, window, cx| {let selections = editor.selections.all::<Point>(cx);let snapshot = editor.buffer().read(cx).snapshot(cx);@@ -804,7 +804,7 @@ impl Vim {times -= 1;}- self.update_editor(window, cx, |_, editor, window, cx| {+ self.update_editor(cx, |_, editor, cx| {editor.transact(window, cx, |editor, window, cx| {for _ in 0..times {editor.join_lines_impl(insert_whitespace, window, cx)@@ -828,10 +828,10 @@ impl Vim {)}- fn show_location(&mut self, _: &ShowLocation, window: &mut Window, cx: &mut Context<Self>) {+ fn show_location(&mut self, _: &ShowLocation, _: &mut Window, cx: &mut Context<Self>) {let count = Vim::take_count(cx);Vim::take_forced_motion(cx);- self.update_editor(window, cx, |vim, editor, _window, cx| {+ self.update_editor(cx, |vim, editor, cx| {let selection = editor.selections.newest_anchor();let Some((buffer, point, _)) = editor.buffer()@@ -875,7 +875,7 @@ impl Vim {fn toggle_comments(&mut self, _: &ToggleComments, window: &mut Window, cx: &mut Context<Self>) {self.record_current_action(cx);self.store_visual_marks(window, cx);- self.update_editor(window, cx, |vim, editor, window, cx| {+ self.update_editor(cx, |vim, editor, cx| {editor.transact(window, cx, |editor, window, cx| {let original_positions = vim.save_selection_starts(editor, cx);editor.toggle_comments(&Default::default(), window, cx);@@ -897,7 +897,7 @@ impl Vim {let count = Vim::take_count(cx).unwrap_or(1);Vim::take_forced_motion(cx);self.stop_recording(cx);- self.update_editor(window, cx, |_, editor, window, cx| {+ self.update_editor(cx, |_, editor, cx| {editor.transact(window, cx, |editor, window, cx| {editor.set_clip_at_line_ends(false, cx);let (map, display_selections) = editor.selections.all_display(cx);diff --git a/crates/vim/src/normal/change.rs b/crates/vim/src/normal/change.rsindex c1bc7a70ae1..fcd36dd7ee5 100644--- a/crates/vim/src/normal/change.rs+++ b/crates/vim/src/normal/change.rs@@ -34,7 +34,7 @@ impl Vim {} else {None};- self.update_editor(window, cx, |vim, editor, window, cx| {+ self.update_editor(cx, |vim, editor, cx| {let text_layout_details = editor.text_layout_details(window);editor.transact(window, cx, |editor, window, cx| {// We are swapping to insert mode anyway. Just set the line end clipping behavior now@@ -111,7 +111,7 @@ impl Vim {cx: &mut Context<Self>,) {let mut objects_found = false;- self.update_editor(window, cx, |vim, editor, window, cx| {+ self.update_editor(cx, |vim, editor, cx| {// We are swapping to insert mode anyway. Just set the line end clipping behavior noweditor.set_clip_at_line_ends(false, cx);editor.transact(window, cx, |editor, window, cx| {diff --git a/crates/vim/src/normal/convert.rs b/crates/vim/src/normal/convert.rsindex cf9498bec9d..4b9c3fc8f77 100644--- a/crates/vim/src/normal/convert.rs+++ b/crates/vim/src/normal/convert.rs@@ -31,7 +31,7 @@ impl Vim {cx: &mut Context<Self>,) {self.stop_recording(cx);- self.update_editor(window, cx, |_, editor, window, cx| {+ self.update_editor(cx, |_, editor, cx| {editor.set_clip_at_line_ends(false, cx);let text_layout_details = editor.text_layout_details(window);editor.transact(window, cx, |editor, window, cx| {@@ -87,7 +87,7 @@ impl Vim {cx: &mut Context<Self>,) {self.stop_recording(cx);- self.update_editor(window, cx, |_, editor, window, cx| {+ self.update_editor(cx, |_, editor, cx| {editor.transact(window, cx, |editor, window, cx| {editor.set_clip_at_line_ends(false, cx);let mut original_positions: HashMap<_, _> = Default::default();@@ -195,7 +195,7 @@ impl Vim {let count = Vim::take_count(cx).unwrap_or(1) as u32;Vim::take_forced_motion(cx);- self.update_editor(window, cx, |vim, editor, window, cx| {+ self.update_editor(cx, |vim, editor, cx| {let mut ranges = Vec::new();let mut cursor_positions = Vec::new();let snapshot = editor.buffer().read(cx).snapshot(cx);diff --git a/crates/vim/src/normal/delete.rs b/crates/vim/src/normal/delete.rsindex 2cf40292cf5..1b7557371a4 100644--- a/crates/vim/src/normal/delete.rs+++ b/crates/vim/src/normal/delete.rs@@ -22,7 +22,7 @@ impl Vim {cx: &mut Context<Self>,) {self.stop_recording(cx);- self.update_editor(window, cx, |vim, editor, window, cx| {+ self.update_editor(cx, |vim, editor, cx| {let text_layout_details = editor.text_layout_details(window);editor.transact(window, cx, |editor, window, cx| {editor.set_clip_at_line_ends(false, cx);@@ -96,7 +96,7 @@ impl Vim {cx: &mut Context<Self>,) {self.stop_recording(cx);- self.update_editor(window, cx, |vim, editor, window, cx| {+ self.update_editor(cx, |vim, editor, cx| {editor.transact(window, cx, |editor, window, cx| {editor.set_clip_at_line_ends(false, cx);// Emulates behavior in vim where if we expanded backwards to include a newlinediff --git a/crates/vim/src/normal/increment.rs b/crates/vim/src/normal/increment.rsindex 51f6e4a0f9b..007514e4729 100644--- a/crates/vim/src/normal/increment.rs+++ b/crates/vim/src/normal/increment.rs@@ -53,7 +53,7 @@ impl Vim {cx: &mut Context<Self>,) {self.store_visual_marks(window, cx);- self.update_editor(window, cx, |vim, editor, window, cx| {+ self.update_editor(cx, |vim, editor, cx| {let mut edits = Vec::new();let mut new_anchors = Vec::new();diff --git a/crates/vim/src/normal/mark.rs b/crates/vim/src/normal/mark.rsindex 57a6108841e..1d6264d593f 100644--- a/crates/vim/src/normal/mark.rs+++ b/crates/vim/src/normal/mark.rs@@ -19,7 +19,7 @@ use crate::{impl Vim {pub fn create_mark(&mut self, text: Arc<str>, window: &mut Window, cx: &mut Context<Self>) {- self.update_editor(window, cx, |vim, editor, window, cx| {+ self.update_editor(cx, |vim, editor, cx| {let anchors = editor.selections.disjoint_anchors()@@ -49,7 +49,7 @@ impl Vim {let mut ends = vec![];let mut reversed = vec![];- self.update_editor(window, cx, |vim, editor, window, cx| {+ self.update_editor(cx, |vim, editor, cx| {let (map, selections) = editor.selections.all_display(cx);for selection in selections {let end = movement::saturating_left(&map, selection.end);@@ -190,7 +190,7 @@ impl Vim {self.pop_operator(window, cx);}let mark = self- .update_editor(window, cx, |vim, editor, window, cx| {+ .update_editor(cx, |vim, editor, cx| {vim.get_mark(&text, editor, window, cx)}).flatten();@@ -209,7 +209,7 @@ impl Vim {let Some(mut anchors) = anchors else { return };- self.update_editor(window, cx, |_, editor, _, cx| {+ self.update_editor(cx, |_, editor, cx| {editor.create_nav_history_entry(cx);});let is_active_operator = self.active_operator().is_some();@@ -231,7 +231,7 @@ impl Vim {|| self.mode == Mode::VisualLine|| self.mode == Mode::VisualBlock;- self.update_editor(window, cx, |_, editor, window, cx| {+ self.update_editor(cx, |_, editor, cx| {let map = editor.snapshot(window, cx);let mut ranges: Vec<Range<Anchor>> = Vec::new();for mut anchor in anchors {diff --git a/crates/vim/src/normal/paste.rs b/crates/vim/src/normal/paste.rsindex 07712fbedd4..0fd17f310e6 100644--- a/crates/vim/src/normal/paste.rs+++ b/crates/vim/src/normal/paste.rs@@ -32,7 +32,7 @@ impl Vim {let count = Vim::take_count(cx).unwrap_or(1);Vim::take_forced_motion(cx);- self.update_editor(window, cx, |vim, editor, window, cx| {+ self.update_editor(cx, |vim, editor, cx| {let text_layout_details = editor.text_layout_details(window);editor.transact(window, cx, |editor, window, cx| {editor.set_clip_at_line_ends(false, cx);@@ -236,7 +236,7 @@ impl Vim {) {self.stop_recording(cx);let selected_register = self.selected_register.take();- self.update_editor(window, cx, |_, editor, window, cx| {+ self.update_editor(cx, |_, editor, cx| {editor.transact(window, cx, |editor, window, cx| {editor.set_clip_at_line_ends(false, cx);editor.change_selections(SelectionEffects::no_scroll(), window, cx, |s| {@@ -273,7 +273,7 @@ impl Vim {) {self.stop_recording(cx);let selected_register = self.selected_register.take();- self.update_editor(window, cx, |_, editor, window, cx| {+ self.update_editor(cx, |_, editor, cx| {let text_layout_details = editor.text_layout_details(window);editor.transact(window, cx, |editor, window, cx| {editor.set_clip_at_line_ends(false, cx);diff --git a/crates/vim/src/normal/scroll.rs b/crates/vim/src/normal/scroll.rsindex e2ae74b52bc..af13bc0fd0f 100644--- a/crates/vim/src/normal/scroll.rs+++ b/crates/vim/src/normal/scroll.rs@@ -97,7 +97,7 @@ impl Vim {let amount = by(Vim::take_count(cx).map(|c| c as f32));Vim::take_forced_motion(cx);self.exit_temporary_normal(window, cx);- self.update_editor(window, cx, |_, editor, window, cx| {+ self.update_editor(cx, |_, editor, cx| {scroll_editor(editor, move_cursor, &amount, window, cx)});}diff --git a/crates/vim/src/normal/search.rs b/crates/vim/src/normal/search.rsindex 24f2cf751f1..e4e95ca48ea 100644--- a/crates/vim/src/normal/search.rs+++ b/crates/vim/src/normal/search.rs@@ -251,7 +251,7 @@ impl Vim {// If the active editor has changed during a search, don't panic.if prior_selections.iter().any(|s| {- self.update_editor(window, cx, |_, editor, window, cx| {+ self.update_editor(cx, |_, editor, cx| {!s.start.is_valid(&editor.snapshot(window, cx).buffer_snapshot)})@@ -457,7 +457,7 @@ impl Vim {else {return;};- if let Some(result) = self.update_editor(window, cx, |vim, editor, window, cx| {+ if let Some(result) = self.update_editor(cx, |vim, editor, cx| {let range = action.range.buffer_range(vim, editor, window, cx)?;let snapshot = &editor.snapshot(window, cx).buffer_snapshot;let end_point = Point::new(range.end.0, snapshot.line_len(range.end));diff --git a/crates/vim/src/normal/substitute.rs b/crates/vim/src/normal/substitute.rsindex a9752f28879..889d4871706 100644--- a/crates/vim/src/normal/substitute.rs+++ b/crates/vim/src/normal/substitute.rs@@ -45,7 +45,7 @@ impl Vim {cx: &mut Context<Self>,) {self.store_visual_marks(window, cx);- self.update_editor(window, cx, |vim, editor, window, cx| {+ self.update_editor(cx, |vim, editor, cx| {editor.set_clip_at_line_ends(false, cx);editor.transact(window, cx, |editor, window, cx| {let text_layout_details = editor.text_layout_details(window);diff --git a/crates/vim/src/normal/toggle_comments.rs b/crates/vim/src/normal/toggle_comments.rsindex 636ea9eec2a..17c3b2d363e 100644--- a/crates/vim/src/normal/toggle_comments.rs+++ b/crates/vim/src/normal/toggle_comments.rs@@ -14,7 +14,7 @@ impl Vim {cx: &mut Context<Self>,) {self.stop_recording(cx);- self.update_editor(window, cx, |_, editor, window, cx| {+ self.update_editor(cx, |_, editor, cx| {let text_layout_details = editor.text_layout_details(window);editor.transact(window, cx, |editor, window, cx| {let mut selection_starts: HashMap<_, _> = Default::default();@@ -51,7 +51,7 @@ impl Vim {cx: &mut Context<Self>,) {self.stop_recording(cx);- self.update_editor(window, cx, |_, editor, window, cx| {+ self.update_editor(cx, |_, editor, cx| {editor.transact(window, cx, |editor, window, cx| {let mut original_positions: HashMap<_, _> = Default::default();editor.change_selections(SelectionEffects::no_scroll(), window, cx, |s| {diff --git a/crates/vim/src/normal/yank.rs b/crates/vim/src/normal/yank.rsindex 847eba3143e..fe8180ffff3 100644--- a/crates/vim/src/normal/yank.rs+++ b/crates/vim/src/normal/yank.rs@@ -25,7 +25,7 @@ impl Vim {window: &mut Window,cx: &mut Context<Self>,) {- self.update_editor(window, cx, |vim, editor, window, cx| {+ self.update_editor(cx, |vim, editor, cx| {let text_layout_details = editor.text_layout_details(window);editor.transact(window, cx, |editor, window, cx| {editor.set_clip_at_line_ends(false, cx);@@ -70,7 +70,7 @@ impl Vim {window: &mut Window,cx: &mut Context<Self>,) {- self.update_editor(window, cx, |vim, editor, window, cx| {+ self.update_editor(cx, |vim, editor, cx| {editor.transact(window, cx, |editor, window, cx| {editor.set_clip_at_line_ends(false, cx);let mut start_positions: HashMap<_, _> = Default::default();diff --git a/crates/vim/src/replace.rs b/crates/vim/src/replace.rsindex aa857ef73e3..eaa9fd50620 100644--- a/crates/vim/src/replace.rs+++ b/crates/vim/src/replace.rs@@ -49,7 +49,7 @@ impl Vim {window: &mut Window,cx: &mut Context<Self>,) {- self.update_editor(window, cx, |vim, editor, window, cx| {+ self.update_editor(cx, |vim, editor, cx| {editor.transact(window, cx, |editor, window, cx| {editor.set_clip_at_line_ends(false, cx);let map = editor.snapshot(window, cx);@@ -94,7 +94,7 @@ impl Vim {window: &mut Window,cx: &mut Context<Self>,) {- self.update_editor(window, cx, |vim, editor, window, cx| {+ self.update_editor(cx, |vim, editor, cx| {editor.transact(window, cx, |editor, window, cx| {editor.set_clip_at_line_ends(false, cx);let map = editor.snapshot(window, cx);@@ -148,7 +148,7 @@ impl Vim {cx: &mut Context<Self>,) {self.stop_recording(cx);- self.update_editor(window, cx, |vim, editor, window, cx| {+ self.update_editor(cx, |vim, editor, cx| {editor.set_clip_at_line_ends(false, cx);let mut selection = editor.selections.newest_display(cx);let snapshot = editor.snapshot(window, cx);@@ -167,7 +167,7 @@ impl Vim {pub fn exchange_visual(&mut self, window: &mut Window, cx: &mut Context<Self>) {self.stop_recording(cx);- self.update_editor(window, cx, |vim, editor, window, cx| {+ self.update_editor(cx, |vim, editor, cx| {let selection = editor.selections.newest_anchor();let new_range = selection.start..selection.end;let snapshot = editor.snapshot(window, cx);@@ -178,7 +178,7 @@ impl Vim {pub fn clear_exchange(&mut self, window: &mut Window, cx: &mut Context<Self>) {self.stop_recording(cx);- self.update_editor(window, cx, |_, editor, _, cx| {+ self.update_editor(cx, |_, editor, cx| {editor.clear_background_highlights::<VimExchange>(cx);});self.clear_operator(window, cx);@@ -193,7 +193,7 @@ impl Vim {cx: &mut Context<Self>,) {self.stop_recording(cx);- self.update_editor(window, cx, |vim, editor, window, cx| {+ self.update_editor(cx, |vim, editor, cx| {editor.set_clip_at_line_ends(false, cx);let text_layout_details = editor.text_layout_details(window);let mut selection = editor.selections.newest_display(cx);diff --git a/crates/vim/src/rewrap.rs b/crates/vim/src/rewrap.rsindex 4cd9449bfa8..85e1967af04 100644--- a/crates/vim/src/rewrap.rs+++ b/crates/vim/src/rewrap.rs@@ -18,7 +18,7 @@ pub(crate) fn register(editor: &mut Editor, cx: &mut Context<Vim>) {Vim::take_count(cx);Vim::take_forced_motion(cx);vim.store_visual_marks(window, cx);- vim.update_editor(window, cx, |vim, editor, window, cx| {+ vim.update_editor(cx, |vim, editor, cx| {editor.transact(window, cx, |editor, window, cx| {let mut positions = vim.save_selection_starts(editor, cx);editor.rewrap_impl(@@ -55,7 +55,7 @@ impl Vim {cx: &mut Context<Self>,) {self.stop_recording(cx);- self.update_editor(window, cx, |_, editor, window, cx| {+ self.update_editor(cx, |_, editor, cx| {let text_layout_details = editor.text_layout_details(window);editor.transact(window, cx, |editor, window, cx| {let mut selection_starts: HashMap<_, _> = Default::default();@@ -100,7 +100,7 @@ impl Vim {cx: &mut Context<Self>,) {self.stop_recording(cx);- self.update_editor(window, cx, |_, editor, window, cx| {+ self.update_editor(cx, |_, editor, cx| {editor.transact(window, cx, |editor, window, cx| {let mut original_positions: HashMap<_, _> = Default::default();editor.change_selections(SelectionEffects::no_scroll(), window, cx, |s| {diff --git a/crates/vim/src/surrounds.rs b/crates/vim/src/surrounds.rsindex 1f77ebda4ab..63cd21e88cb 100644--- a/crates/vim/src/surrounds.rs+++ b/crates/vim/src/surrounds.rs@@ -29,7 +29,7 @@ impl Vim {let count = Vim::take_count(cx);let forced_motion = Vim::take_forced_motion(cx);let mode = self.mode;- self.update_editor(window, cx, |_, editor, window, cx| {+ self.update_editor(cx, |_, editor, cx| {let text_layout_details = editor.text_layout_details(window);editor.transact(window, cx, |editor, window, cx| {editor.set_clip_at_line_ends(false, cx);@@ -140,7 +140,7 @@ impl Vim {};let surround = pair.end != *text;- self.update_editor(window, cx, |_, editor, window, cx| {+ self.update_editor(cx, |_, editor, cx| {editor.transact(window, cx, |editor, window, cx| {editor.set_clip_at_line_ends(false, cx);@@ -228,7 +228,7 @@ impl Vim {) {if let Some(will_replace_pair) = object_to_bracket_pair(target) {self.stop_recording(cx);- self.update_editor(window, cx, |_, editor, window, cx| {+ self.update_editor(cx, |_, editor, cx| {editor.transact(window, cx, |editor, window, cx| {editor.set_clip_at_line_ends(false, cx);@@ -344,7 +344,7 @@ impl Vim {) -> bool {let mut valid = false;if let Some(pair) = object_to_bracket_pair(object) {- self.update_editor(window, cx, |_, editor, window, cx| {+ self.update_editor(cx, |_, editor, cx| {editor.transact(window, cx, |editor, window, cx| {editor.set_clip_at_line_ends(false, cx);let (display_map, selections) = editor.selections.all_adjusted_display(cx);diff --git a/crates/vim/src/vim.rs b/crates/vim/src/vim.rsindex 72edbe77ed1..661bb71c917 100644--- a/crates/vim/src/vim.rs+++ b/crates/vim/src/vim.rs@@ -748,7 +748,7 @@ impl Vim {editor,cx,|vim, action: &editor::actions::AcceptEditPrediction, window, cx| {- vim.update_editor(window, cx, |_, editor, window, cx| {+ vim.update_editor(cx, |_, editor, cx| {editor.accept_edit_prediction(action, window, cx);});// In non-insertion modes, predictions will be hidden and instead a jump will be@@ -847,7 +847,7 @@ impl Vim {if let Some(action) = keystroke_event.action.as_ref() {// Keystroke is handled by the vim system, so continue forwardif action.name().starts_with("vim::") {- self.update_editor(window, cx, |_, editor, _, cx| {+ self.update_editor(cx, |_, editor, cx| {editor.hide_mouse_cursor(HideMouseCursorOrigin::MovementAction, cx)});return;@@ -909,7 +909,7 @@ impl Vim {anchor,is_deactivate,} => {- self.update_editor(window, cx, |vim, editor, window, cx| {+ self.update_editor(cx, |vim, editor, cx| {let mark = if *is_deactivate {"\"".to_string()} else {@@ -972,7 +972,7 @@ impl Vim {if mode == Mode::Normal || mode != last_mode {self.current_tx.take();self.current_anchor.take();- self.update_editor(window, cx, |_, editor, _, _| {+ self.update_editor(cx, |_, editor, _| {editor.clear_selection_drag_state();});}@@ -988,7 +988,7 @@ impl Vim {&& self.mode != self.last_mode&& (self.mode == Mode::Insert || self.last_mode == Mode::Insert){- self.update_editor(window, cx, |vim, editor, _, cx| {+ self.update_editor(cx, |vim, editor, cx| {let is_relative = vim.mode != Mode::Insert;editor.set_relative_line_number(Some(is_relative), cx)});@@ -1003,7 +1003,7 @@ impl Vim {}// Adjust selections- self.update_editor(window, cx, |vim, editor, window, cx| {+ self.update_editor(cx, |vim, editor, cx| {if last_mode != Mode::VisualBlock && last_mode.is_visual() && mode == Mode::VisualBlock{vim.visual_block_motion(true, editor, window, cx, |_, point, goal| {@@ -1214,7 +1214,7 @@ impl Vim {if preserve_selection {self.switch_mode(Mode::Visual, true, window, cx);} else {- self.update_editor(window, cx, |_, editor, window, cx| {+ self.update_editor(cx, |_, editor, cx| {editor.set_clip_at_line_ends(false, cx);editor.change_selections(SelectionEffects::no_scroll(), window, cx, |s| {s.move_with(|_, selection| {@@ -1232,18 +1232,18 @@ impl Vim {if let Some(old_vim) = Vim::globals(cx).focused_vim() {if old_vim.entity_id() != cx.entity().entity_id() {old_vim.update(cx, |vim, cx| {- vim.update_editor(window, cx, |_, editor, _, cx| {+ vim.update_editor(cx, |_, editor, cx| {editor.set_relative_line_number(None, cx)});});- self.update_editor(window, cx, |vim, editor, _, cx| {+ self.update_editor(cx, |vim, editor, cx| {let is_relative = vim.mode != Mode::Insert;editor.set_relative_line_number(Some(is_relative), cx)});}} else {- self.update_editor(window, cx, |vim, editor, _, cx| {+ self.update_editor(cx, |vim, editor, cx| {let is_relative = vim.mode != Mode::Insert;editor.set_relative_line_number(Some(is_relative), cx)});@@ -1256,35 +1256,30 @@ impl Vim {self.stop_recording_immediately(NormalBefore.boxed_clone(), cx);self.store_visual_marks(window, cx);self.clear_operator(window, cx);- self.update_editor(window, cx, |vim, editor, _, cx| {+ self.update_editor(cx, |vim, editor, cx| {if vim.cursor_shape(cx) == CursorShape::Block {editor.set_cursor_shape(CursorShape::Hollow, cx);}});}- fn cursor_shape_changed(&mut self, window: &mut Window, cx: &mut Context<Self>) {- self.update_editor(window, cx, |vim, editor, _, cx| {+ fn cursor_shape_changed(&mut self, _: &mut Window, cx: &mut Context<Self>) {+ self.update_editor(cx, |vim, editor, cx| {editor.set_cursor_shape(vim.cursor_shape(cx), cx);});}fn update_editor<S>(&mut self,- window: &mut Window,cx: &mut Context<Self>,- update: impl FnOnce(&mut Self, &mut Editor, &mut Window, &mut Context<Editor>) -> S,+ update: impl FnOnce(&mut Self, &mut Editor, &mut Context<Editor>) -> S,) -> Option<S> {let editor = self.editor.upgrade()?;- Some(editor.update(cx, |editor, cx| update(self, editor, window, cx)))+ Some(editor.update(cx, |editor, cx| update(self, editor, cx)))}- fn editor_selections(- &mut self,- window: &mut Window,- cx: &mut Context<Self>,- ) -> Vec<Range<Anchor>> {- self.update_editor(window, cx, |_, editor, _, _| {+ fn editor_selections(&mut self, _: &mut Window, cx: &mut Context<Self>) -> Vec<Range<Anchor>> {+ self.update_editor(cx, |_, editor, _| {editor.selections.disjoint_anchors()@@ -1300,7 +1295,7 @@ impl Vim {window: &mut Window,cx: &mut Context<Self>,) -> Option<String> {- self.update_editor(window, cx, |_, editor, window, cx| {+ self.update_editor(cx, |_, editor, cx| {let selection = editor.selections.newest::<usize>(cx);let snapshot = &editor.snapshot(window, cx).buffer_snapshot;@@ -1489,7 +1484,7 @@ impl Vim {) {match self.mode {Mode::VisualLine | Mode::VisualBlock | Mode::Visual => {- self.update_editor(window, cx, |vim, editor, window, cx| {+ self.update_editor(cx, |vim, editor, cx| {let original_mode = vim.undo_modes.get(transaction_id);editor.change_selections(SelectionEffects::no_scroll(), window, cx, |s| {match original_mode {@@ -1520,7 +1515,7 @@ impl Vim {self.switch_mode(Mode::Normal, true, window, cx)}Mode::Normal => {- self.update_editor(window, cx, |_, editor, window, cx| {+ self.update_editor(cx, |_, editor, cx| {editor.change_selections(SelectionEffects::no_scroll(), window, cx, |s| {s.move_with(|map, selection| {selection@@ -1547,7 +1542,7 @@ impl Vim {self.current_anchor = Some(newest);} else if self.current_anchor.as_ref().unwrap() != &newest {if let Some(tx_id) = self.current_tx.take() {- self.update_editor(window, cx, |_, editor, _, cx| {+ self.update_editor(cx, |_, editor, cx| {editor.group_until_transaction(tx_id, cx)});}@@ -1694,7 +1689,7 @@ impl Vim {}Some(Operator::Register) => match self.mode {Mode::Insert => {- self.update_editor(window, cx, |_, editor, window, cx| {+ self.update_editor(cx, |_, editor, cx| {if let Some(register) = Vim::update_globals(cx, |globals, cx| {globals.read_register(text.chars().next(), Some(editor), cx)}) {@@ -1720,7 +1715,7 @@ impl Vim {}if self.mode == Mode::Normal {- self.update_editor(window, cx, |_, editor, window, cx| {+ self.update_editor(cx, |_, editor, cx| {editor.accept_edit_prediction(&editor::actions::AcceptEditPrediction {},window,@@ -1733,7 +1728,7 @@ impl Vim {}fn sync_vim_settings(&mut self, window: &mut Window, cx: &mut Context<Self>) {- self.update_editor(window, cx, |vim, editor, window, cx| {+ self.update_editor(cx, |vim, editor, cx| {editor.set_cursor_shape(vim.cursor_shape(cx), cx);editor.set_clip_at_line_ends(vim.clip_at_line_ends(), cx);editor.set_collapse_matches(true);diff --git a/crates/vim/src/visual.rs b/crates/vim/src/visual.rsindex ca8734ba8b3..7bfd8dc8bef 100644--- a/crates/vim/src/visual.rs+++ b/crates/vim/src/visual.rs@@ -104,7 +104,7 @@ pub fn register(editor: &mut Editor, cx: &mut Context<Vim>) {let count = Vim::take_count(cx).unwrap_or(1);Vim::take_forced_motion(cx);for _ in 0..count {- vim.update_editor(window, cx, |_, editor, window, cx| {+ vim.update_editor(cx, |_, editor, cx| {editor.select_larger_syntax_node(&Default::default(), window, cx);});}@@ -117,7 +117,7 @@ pub fn register(editor: &mut Editor, cx: &mut Context<Vim>) {let count = Vim::take_count(cx).unwrap_or(1);Vim::take_forced_motion(cx);for _ in 0..count {- vim.update_editor(window, cx, |_, editor, window, cx| {+ vim.update_editor(cx, |_, editor, cx| {editor.select_smaller_syntax_node(&Default::default(), window, cx);});}@@ -129,7 +129,7 @@ pub fn register(editor: &mut Editor, cx: &mut Context<Vim>) {return;};let marks = vim- .update_editor(window, cx, |vim, editor, window, cx| {+ .update_editor(cx, |vim, editor, cx| {vim.get_mark("<", editor, window, cx).zip(vim.get_mark(">", editor, window, cx))})@@ -148,7 +148,7 @@ pub fn register(editor: &mut Editor, cx: &mut Context<Vim>) {vim.create_visual_marks(vim.mode, window, cx);}- vim.update_editor(window, cx, |_, editor, window, cx| {+ 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();@@ -189,7 +189,7 @@ impl Vim {window: &mut Window,cx: &mut Context<Self>,) {- self.update_editor(window, cx, |vim, editor, window, cx| {+ self.update_editor(cx, |vim, editor, cx| {let text_layout_details = editor.text_layout_details(window);if vim.mode == Mode::VisualBlock&& !matches!(@@ -397,7 +397,7 @@ impl Vim {self.switch_mode(target_mode, true, window, cx);}- self.update_editor(window, cx, |_, editor, window, cx| {+ self.update_editor(cx, |_, editor, cx| {editor.change_selections(Default::default(), window, cx, |s| {s.move_with(|map, selection| {let mut mut_selection = selection.clone();@@ -475,7 +475,7 @@ impl Vim {window: &mut Window,cx: &mut Context<Self>,) {- self.update_editor(window, cx, |_, editor, window, cx| {+ self.update_editor(cx, |_, editor, cx| {editor.split_selection_into_lines(&Default::default(), window, cx);editor.change_selections(Default::default(), window, cx, |s| {s.move_cursors_with(|map, cursor, _| {@@ -493,7 +493,7 @@ impl Vim {window: &mut Window,cx: &mut Context<Self>,) {- self.update_editor(window, cx, |_, editor, window, cx| {+ self.update_editor(cx, |_, editor, cx| {editor.split_selection_into_lines(&Default::default(), window, cx);editor.change_selections(Default::default(), window, cx, |s| {s.move_cursors_with(|map, cursor, _| {@@ -517,7 +517,7 @@ impl Vim {}pub fn other_end(&mut self, _: &OtherEnd, window: &mut Window, cx: &mut Context<Self>) {- self.update_editor(window, cx, |_, editor, window, cx| {+ self.update_editor(cx, |_, editor, cx| {editor.change_selections(Default::default(), window, cx, |s| {s.move_with(|_, selection| {selection.reversed = !selection.reversed;@@ -533,7 +533,7 @@ impl Vim {cx: &mut Context<Self>,) {let mode = self.mode;- self.update_editor(window, cx, |_, editor, window, cx| {+ self.update_editor(cx, |_, editor, cx| {editor.change_selections(Default::default(), window, cx, |s| {s.move_with(|_, selection| {selection.reversed = !selection.reversed;@@ -547,7 +547,7 @@ impl Vim {pub fn visual_delete(&mut self, line_mode: bool, window: &mut Window, cx: &mut Context<Self>) {self.store_visual_marks(window, cx);- self.update_editor(window, cx, |vim, editor, window, cx| {+ self.update_editor(cx, |vim, editor, cx| {let mut original_columns: HashMap<_, _> = Default::default();let line_mode = line_mode || editor.selections.line_mode;editor.selections.line_mode = false;@@ -631,7 +631,7 @@ impl Vim {pub fn visual_yank(&mut self, line_mode: bool, window: &mut Window, cx: &mut Context<Self>) {self.store_visual_marks(window, cx);- self.update_editor(window, cx, |vim, editor, window, cx| {+ self.update_editor(cx, |vim, editor, cx| {let line_mode = line_mode || editor.selections.line_mode;// For visual line mode, adjust selections to avoid yanking the next line when on \n@@ -679,7 +679,7 @@ impl Vim {cx: &mut Context<Self>,) {self.stop_recording(cx);- self.update_editor(window, cx, |_, editor, window, cx| {+ self.update_editor(cx, |_, editor, cx| {editor.transact(window, cx, |editor, window, cx| {let (display_map, selections) = editor.selections.all_adjusted_display(cx);@@ -722,7 +722,7 @@ impl Vim {Vim::take_forced_motion(cx);let count =Vim::take_count(cx).unwrap_or_else(|| if self.mode.is_visual() { 1 } else { 2 });- self.update_editor(window, cx, |_, editor, window, cx| {+ self.update_editor(cx, |_, editor, cx| {editor.set_clip_at_line_ends(false, cx);for _ in 0..count {if editor@@ -745,7 +745,7 @@ impl Vim {Vim::take_forced_motion(cx);let count =Vim::take_count(cx).unwrap_or_else(|| if self.mode.is_visual() { 1 } else { 2 });- self.update_editor(window, cx, |_, editor, window, cx| {+ self.update_editor(cx, |_, editor, cx| {for _ in 0..count {if editor.select_previous(&Default::default(), window, cx)@@ -773,7 +773,7 @@ impl Vim {let mut start_selection = 0usize;let mut end_selection = 0usize;- self.update_editor(window, cx, |_, editor, _, _| {+ self.update_editor(cx, |_, editor, _| {editor.set_collapse_matches(false);});if vim_is_normal {@@ -791,7 +791,7 @@ impl Vim {}});}- self.update_editor(window, cx, |_, editor, _, cx| {+ self.update_editor(cx, |_, editor, cx| {let latest = editor.selections.newest::<usize>(cx);start_selection = latest.start;end_selection = latest.end;@@ -812,7 +812,7 @@ impl Vim {self.stop_replaying(cx);return;}- self.update_editor(window, cx, |_, editor, window, cx| {+ self.update_editor(cx, |_, editor, cx| {let latest = editor.selections.newest::<usize>(cx);if vim_is_normal {start_selection = latest.start;