diff options
author | Gokul Soumya | 2021-09-05 12:20:11 +0000 |
---|---|---|
committer | GitHub | 2021-09-05 12:20:11 +0000 |
commit | 6e21a748b87a4eb9381ea0d24117711c5b547ab1 (patch) | |
tree | c3f9ec49750f768f038c64b2d6aa0a74b9664af1 /helix-term/src/keymap.rs | |
parent | 183dcce992d7c5b2065a93c5835d61e8ee4e9f05 (diff) |
Fix escape not exiting insert mode (#712)
Regression due to #635 where escape key in insert mode
would not exit normal mode. This happened due to hard
coding the escape key to cancel a sticky keymap node.
Diffstat (limited to 'helix-term/src/keymap.rs')
-rw-r--r-- | helix-term/src/keymap.rs | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/helix-term/src/keymap.rs b/helix-term/src/keymap.rs index f0f980bd..aa60482d 100644 --- a/helix-term/src/keymap.rs +++ b/helix-term/src/keymap.rs @@ -287,13 +287,14 @@ impl Keymap { /// sticky node is in use, it will be cleared. pub fn get(&mut self, key: KeyEvent) -> KeymapResult { if let key!(Esc) = key { - if self.state.is_empty() { - self.sticky = None; + if !self.state.is_empty() { + return KeymapResult::new( + // Note that Esc is not included here + KeymapResultKind::Cancelled(self.state.drain(..).collect()), + self.sticky(), + ); } - return KeymapResult::new( - KeymapResultKind::Cancelled(self.state.drain(..).collect()), - self.sticky(), - ); + self.sticky = None; } let first = self.state.get(0).unwrap_or(&key); |