Reduce KeyPress duplication in text_editor

This commit is contained in:
Héctor Ramón Jiménez 2024-07-26 10:43:36 +02:00
parent 28d8b73846
commit e73c8b0413
No known key found for this signature in database
GPG key ID: 4C07CEC81AFA161F

View file

@ -1017,20 +1017,17 @@ impl<Message> Update<Message> {
Status::Active
};
let key_press = KeyPress {
key,
modifiers,
text,
status,
};
if let Some(key_binding) = key_binding {
key_binding(KeyPress {
key,
modifiers,
text,
status,
})
key_binding(key_press)
} else {
Binding::from_key_press(KeyPress {
key,
modifiers,
text,
status,
})
Binding::from_key_press(key_press)
}
.map(Self::Binding)
}