Skip to content

Commit

Permalink
Distinguish between characters only based on the character, rather th…
Browse files Browse the repository at this point in the history
…an shift
  • Loading branch information
Gskartwii committed Oct 5, 2021
1 parent ea32fb4 commit 198932a
Showing 1 changed file with 9 additions and 12 deletions.
21 changes: 9 additions & 12 deletions src/keymap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,9 @@ impl<T: Copy> KeyMap<T> {
pub fn event_to_action(&self, evt: &Event) -> Option<T> {
if let Event::Key(evt) = evt {
self.maps
.get(evt)
.or_else(|| {
self.maps.get(&KeyEvent {
modifiers: evt.modifiers | KeyModifiers::SHIFT,
..*evt
})
.get(&KeyEvent {
modifiers: evt.modifiers & !KeyModifiers::SHIFT,
..*evt
})
.copied()
} else {
Expand All @@ -27,17 +24,17 @@ impl<T: Copy> KeyMap<T> {

macro_rules! normalized_char {
($ch:expr) => {
if $ch.is_ascii_uppercase() {
/*if $ch.is_ascii_uppercase() {
KeyEvent {
code: KeyCode::Char($ch),
modifiers: KeyModifiers::SHIFT,
}
} else {
KeyEvent {
code: KeyCode::Char($ch),
modifiers: KeyModifiers::NONE,
}
} else {*/
KeyEvent {
code: KeyCode::Char($ch),
modifiers: KeyModifiers::NONE,
}
/*}*/
};
}

Expand Down

0 comments on commit 198932a

Please sign in to comment.