Skip to content

Commit

Permalink
Fix shift related key bindings not working in Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
YS-L committed May 19, 2024
1 parent dd85d40 commit 7d54d6f
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/input.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,16 @@ impl InputHandler {
}

pub fn next(&mut self) -> Control {
if let CsvlensEvent::Input(key) = self.events.next().unwrap() {
if let CsvlensEvent::Input(mut key) = self.events.next().unwrap() {
let platform_consistent_shift = match (key.code, key.modifiers) {
(KeyCode::Char(c), _) => c.is_ascii_uppercase(),
(_, m) => m.contains(KeyModifiers::SHIFT),
};
if platform_consistent_shift {
key.modifiers.insert(KeyModifiers::SHIFT);
} else {
key.modifiers.remove(KeyModifiers::SHIFT);
}
if self.is_help_mode() {
return self.handler_help(key);
} else if self.is_input_buffering() {
Expand Down

0 comments on commit 7d54d6f

Please sign in to comment.