diff options
author | 2024-07-26 10:43:36 +0200 | |
---|---|---|
committer | 2024-07-26 11:02:04 +0200 | |
commit | e73c8b0413e7b32c13373388fe835bff74644a42 (patch) | |
tree | ab02f86b916d55b0120bf3ead2e6fcbc4062b090 /widget | |
parent | 28d8b73846f49d23790e8c91c31fd2168014a6a4 (diff) | |
download | iced-e73c8b0413e7b32c13373388fe835bff74644a42.tar.gz iced-e73c8b0413e7b32c13373388fe835bff74644a42.tar.bz2 iced-e73c8b0413e7b32c13373388fe835bff74644a42.zip |
Reduce `KeyPress` duplication in `text_editor`
Diffstat (limited to 'widget')
-rw-r--r-- | widget/src/text_editor.rs | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/widget/src/text_editor.rs b/widget/src/text_editor.rs index fa7863da..56fb7578 100644 --- a/widget/src/text_editor.rs +++ b/widget/src/text_editor.rs @@ -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) } |