From 243a1a854eb542bf8748838156f1eb97e3a39632 Mon Sep 17 00:00:00 2001 From: Julia Date: Fri, 21 Jul 2023 14:25:30 -0400 Subject: [PATCH] Avoid panic from assuming a vim operator exists on the operator stack --- crates/vim/src/visual.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/crates/vim/src/visual.rs b/crates/vim/src/visual.rs index 5e22e77bf0..d87e4ff974 100644 --- a/crates/vim/src/visual.rs +++ b/crates/vim/src/visual.rs @@ -58,7 +58,9 @@ pub fn visual_motion(motion: Motion, times: Option, cx: &mut WindowContex pub fn visual_object(object: Object, cx: &mut WindowContext) { Vim::update(cx, |vim, cx| { - if let Operator::Object { around } = vim.pop_operator(cx) { + if let Some(Operator::Object { around }) = vim.active_operator() { + vim.pop_operator(cx); + vim.update_active_editor(cx, |editor, cx| { editor.change_selections(Some(Autoscroll::fit()), cx, |s| { s.move_with(|map, selection| {