summaryrefslogtreecommitdiffstats
path: root/native
diff options
context:
space:
mode:
Diffstat (limited to 'native')
-rw-r--r--native/src/widget/text_input.rs40
1 files changed, 40 insertions, 0 deletions
diff --git a/native/src/widget/text_input.rs b/native/src/widget/text_input.rs
index 400cae2a..de6032b7 100644
--- a/native/src/widget/text_input.rs
+++ b/native/src/widget/text_input.rs
@@ -501,6 +501,46 @@ where
self.state.cursor.move_to(self.value.len());
}
}
+ keyboard::KeyCode::C
+ if self
+ .state
+ .keyboard_modifiers
+ .is_command_pressed() =>
+ {
+ match self.state.cursor.selection(&self.value) {
+ Some((start, end)) => {
+ clipboard.write(
+ self.value.select(start, end).to_string(),
+ );
+ }
+ None => {}
+ }
+ }
+ keyboard::KeyCode::X
+ if self
+ .state
+ .keyboard_modifiers
+ .is_command_pressed() =>
+ {
+ match self.state.cursor.selection(&self.value) {
+ Some((start, end)) => {
+ clipboard.write(
+ self.value.select(start, end).to_string(),
+ );
+ }
+ None => {}
+ }
+
+ let mut editor = Editor::new(
+ &mut self.value,
+ &mut self.state.cursor,
+ );
+
+ editor.delete();
+
+ let message = (self.on_change)(editor.contents());
+ messages.push(message);
+ }
keyboard::KeyCode::V => {
if self.state.keyboard_modifiers.is_command_pressed() {
let content = match self.state.is_pasting.take() {