From 8a2fa692f26f5bff5861151f395304837f5d93ec Mon Sep 17 00:00:00 2001 From: Gokul Soumya Date: Wed, 28 Jul 2021 21:33:05 +0530 Subject: Refactor case where key event is solely a character --- helix-view/src/input.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'helix-view') diff --git a/helix-view/src/input.rs b/helix-view/src/input.rs index 8d9ee6fb..28b204bb 100644 --- a/helix-view/src/input.rs +++ b/helix-view/src/input.rs @@ -15,10 +15,10 @@ pub struct KeyEvent { } impl KeyEvent { - /// Get only the character involved in this event + /// If a character was pressed (without modifiers), return it. pub fn char(&self) -> Option { match self.code { - KeyCode::Char(ch) => Some(ch), + KeyCode::Char(ch) if self.modifiers.is_empty() => Some(ch), _ => None, } } -- cgit v1.2.3-70-g09d2