Do not clone Key
This commit is contained in:
parent
1c82463dfb
commit
8b5a235129
3 changed files with 4 additions and 5 deletions
|
|
@ -22,8 +22,8 @@ pub struct KeyBind {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl KeyBind {
|
impl KeyBind {
|
||||||
pub fn matches(&self, modifiers: Modifiers, key: Key) -> bool {
|
pub fn matches(&self, modifiers: Modifiers, key: &Key) -> bool {
|
||||||
self.key == key
|
key == &self.key
|
||||||
&& modifiers.logo() == self.modifiers.contains(&Modifier::Super)
|
&& modifiers.logo() == self.modifiers.contains(&Modifier::Super)
|
||||||
&& modifiers.control() == self.modifiers.contains(&Modifier::Ctrl)
|
&& modifiers.control() == self.modifiers.contains(&Modifier::Ctrl)
|
||||||
&& modifiers.alt() == self.modifiers.contains(&Modifier::Alt)
|
&& modifiers.alt() == self.modifiers.contains(&Modifier::Alt)
|
||||||
|
|
|
||||||
|
|
@ -1019,7 +1019,7 @@ impl Application for App {
|
||||||
},
|
},
|
||||||
Message::Key(modifiers, key) => {
|
Message::Key(modifiers, key) => {
|
||||||
for (key_bind, action) in self.key_binds.iter() {
|
for (key_bind, action) in self.key_binds.iter() {
|
||||||
if key_bind.matches(modifiers, key.clone()) {
|
if key_bind.matches(modifiers, &key) {
|
||||||
return self.update(action.message(None));
|
return self.update(action.message(None));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -682,8 +682,7 @@ where
|
||||||
status = Status::Captured;
|
status = Status::Captured;
|
||||||
}
|
}
|
||||||
Named::Space if !modifiers.control() => {
|
Named::Space if !modifiers.control() => {
|
||||||
terminal
|
terminal.input_scroll(format!("{}{}", alt_prefix, " ").as_bytes().to_vec());
|
||||||
.input_scroll(format!("{}{}", alt_prefix, " ").as_bytes().to_vec());
|
|
||||||
status = Status::Captured;
|
status = Status::Captured;
|
||||||
}
|
}
|
||||||
Named::Tab => {
|
Named::Tab => {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue