summaryrefslogtreecommitdiffstats
path: root/widget
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector@hecrj.dev>2024-07-26 10:43:36 +0200
committerLibravatar Héctor Ramón Jiménez <hector@hecrj.dev>2024-07-26 11:02:04 +0200
commite73c8b0413e7b32c13373388fe835bff74644a42 (patch)
treeab02f86b916d55b0120bf3ead2e6fcbc4062b090 /widget
parent28d8b73846f49d23790e8c91c31fd2168014a6a4 (diff)
downloadiced-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.rs21
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)
}