From 8e277ad8baf43ce0649ceb2fad96386f4276c686 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bla=C5=BE=20Hrastnik?= Date: Fri, 25 Jun 2021 13:13:15 +0900 Subject: [PATCH] fix: crossterm -> input key conversion --- helix-view/src/keyboard.rs | 28 ++++++++++++---------------- 1 file changed, 12 insertions(+), 16 deletions(-) diff --git a/helix-view/src/keyboard.rs b/helix-view/src/keyboard.rs index 8a2b65450..30a169e10 100644 --- a/helix-view/src/keyboard.rs +++ b/helix-view/src/keyboard.rs @@ -18,16 +18,14 @@ impl From 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 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