aboutsummaryrefslogtreecommitdiff
path: root/helix-view/src/input.rs
diff options
context:
space:
mode:
authorGokul Soumya2021-07-28 16:03:05 +0000
committerIvan Tham2021-07-29 00:39:58 +0000
commit8a2fa692f26f5bff5861151f395304837f5d93ec (patch)
tree73c65b6c49a86f78438e68c5d6c16ad2b9c1de94 /helix-view/src/input.rs
parentb90450b9e8b995e96a723a5d8c7b179ad2967c5a (diff)
Refactor case where key event is solely a character
Diffstat (limited to 'helix-view/src/input.rs')
-rw-r--r--helix-view/src/input.rs4
1 files changed, 2 insertions, 2 deletions
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<char> {
match self.code {
- KeyCode::Char(ch) => Some(ch),
+ KeyCode::Char(ch) if self.modifiers.is_empty() => Some(ch),
_ => None,
}
}