Skip to content

Commit

Permalink
vim: Making the visual test pass
Browse files Browse the repository at this point in the history
  • Loading branch information
axelcarl committed Nov 9, 2024
1 parent f89ef10 commit 6ce6045
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions crates/vim/src/vim.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ use gpui::{
actions, impl_actions, Action, AppContext, Entity, EventEmitter, KeyContext, KeystrokeEvent,
Render, Subscription, View, ViewContext, WeakView,
};
use insert::NormalBefore;
use insert::{NormalBefore, TemporaryNormal};
use language::{CursorShape, Point, Selection, SelectionGoal, TransactionId};
pub use mode_indicator::ModeIndicator;
use motion::Motion;
Expand Down Expand Up @@ -356,7 +356,13 @@ impl Vim {
fn observe_keystrokes(&mut self, keystroke_event: &KeystrokeEvent, cx: &mut ViewContext<Self>) {
if self.exit_temporary_mode {
self.exit_temporary_mode = false;
self.switch_mode(Mode::Insert, false, cx);
// Don't switch to insert mode if the next action is temporary_normal.
if let Some(action) = keystroke_event.action.as_ref() {
if action.as_any().downcast_ref::<TemporaryNormal>().is_some() {
return;
}
}
self.switch_mode(Mode::Insert, false, cx)
}
if let Some(action) = keystroke_event.action.as_ref() {
// Keystroke is handled by the vim system, so continue forward
Expand Down

0 comments on commit 6ce6045

Please sign in to comment.