summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Hrastnik2021-06-03 13:26:24 +0000
committerBlaž Hrastnik2021-06-03 14:16:04 +0000
commitc1c3750d3801558bb9e6722e67d724b480a4cffa (patch)
treeedf9c6d1c556aabb4172946bd65bb7e1ba2ceeb7
parentdaad8ebe1294ce11392c4a8d2c0316498d1247cf (diff)
key is now modified in place at start of handle_event
-rw-r--r--helix-term/src/ui/editor.rs10
1 files changed, 5 insertions, 5 deletions
diff --git a/helix-term/src/ui/editor.rs b/helix-term/src/ui/editor.rs
index da95763e..b1c4ce3f 100644
--- a/helix-term/src/ui/editor.rs
+++ b/helix-term/src/ui/editor.rs
@@ -544,6 +544,7 @@ impl Component for EditorView {
EventResult::Consumed(None)
}
Event::Key(mut key) => {
+ canonicalize_key(&mut key);
// clear status
cx.editor.status_msg = None;
@@ -565,7 +566,7 @@ impl Component for EditorView {
match mode {
Mode::Insert => {
// record last_insert key
- self.last_insert.1.push(canonicalize_key(&mut key));
+ self.last_insert.1.push(key);
// let completion swallow the event if necessary
let mut consumed = false;
@@ -590,7 +591,7 @@ impl Component for EditorView {
// if completion didn't take the event, we pass it onto commands
if !consumed {
- self.insert_mode(&mut cxt, canonicalize_key(&mut key));
+ self.insert_mode(&mut cxt, key);
// lastly we recalculate completion
if let Some(completion) = &mut self.completion {
@@ -601,7 +602,7 @@ impl Component for EditorView {
}
}
}
- mode => self.command_mode(mode, &mut cxt, canonicalize_key(&mut key)),
+ mode => self.command_mode(mode, &mut cxt, key),
}
}
@@ -691,7 +692,7 @@ impl Component for EditorView {
}
}
-fn canonicalize_key(key: &mut KeyEvent) -> KeyEvent {
+fn canonicalize_key(key: &mut KeyEvent) {
if let KeyEvent {
code: KeyCode::Char(_),
modifiers: _,
@@ -699,5 +700,4 @@ fn canonicalize_key(key: &mut KeyEvent) -> KeyEvent {
{
key.modifiers.remove(KeyModifiers::SHIFT)
}
- *key
}