diff options
author | Blaž Hrastnik | 2021-06-25 04:13:15 +0000 |
---|---|---|
committer | Blaž Hrastnik | 2021-06-25 04:13:15 +0000 |
commit | 8e277ad8baf43ce0649ceb2fad96386f4276c686 (patch) | |
tree | ec178b09b3b35f274c3522fed6ea8b56da8cbd10 /helix-view | |
parent | 4418e17547562e211952b9e8585916e04b858b3b (diff) |
fix: crossterm -> input key conversion
Diffstat (limited to 'helix-view')
-rw-r--r-- | helix-view/src/keyboard.rs | 28 |
1 files changed, 12 insertions, 16 deletions
diff --git a/helix-view/src/keyboard.rs b/helix-view/src/keyboard.rs index 8a2b6545..30a169e1 100644 --- a/helix-view/src/keyboard.rs +++ b/helix-view/src/keyboard.rs @@ -18,16 +18,14 @@ impl From<KeyModifiers> for crossterm::event::KeyModifiers { let mut result = CKeyModifiers::NONE;
- if key_modifiers & KeyModifiers::SHIFT != KeyModifiers::NONE {
- result &= CKeyModifiers::SHIFT;
+ if key_modifiers.contains(KeyModifiers::SHIFT) {
+ result.insert(CKeyModifiers::SHIFT);
}
-
- if key_modifiers & KeyModifiers::CONTROL != KeyModifiers::NONE {
- result &= CKeyModifiers::CONTROL;
+ if key_modifiers.contains(KeyModifiers::CONTROL) {
+ result.insert(CKeyModifiers::CONTROL);
}
-
- if key_modifiers & KeyModifiers::ALT != KeyModifiers::NONE {
- result &= CKeyModifiers::ALT;
+ if key_modifiers.contains(KeyModifiers::ALT) {
+ result.insert(CKeyModifiers::ALT);
}
result
@@ -41,16 +39,14 @@ impl From<crossterm::event::KeyModifiers> for KeyModifiers { let mut result = KeyModifiers::NONE;
- if val & CKeyModifiers::SHIFT != CKeyModifiers::NONE {
- result &= KeyModifiers::SHIFT;
+ if val.contains(CKeyModifiers::SHIFT) {
+ result.insert(KeyModifiers::SHIFT);
}
-
- if val & CKeyModifiers::CONTROL != CKeyModifiers::NONE {
- result &= KeyModifiers::CONTROL;
+ if val.contains(CKeyModifiers::CONTROL) {
+ result.insert(KeyModifiers::CONTROL);
}
-
- if val & CKeyModifiers::ALT != CKeyModifiers::NONE {
- result &= KeyModifiers::ALT;
+ if val.contains(CKeyModifiers::ALT) {
+ result.insert(KeyModifiers::ALT);
}
result
|