diff options
Diffstat (limited to 'helix-view/src/keyboard.rs')
-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
|