diff options
author | 2024-02-13 03:14:08 +0100 | |
---|---|---|
committer | 2024-02-13 03:15:21 +0100 | |
commit | 508b3fe1f1405bdb8b860d0d63e2c7adfbbd51ca (patch) | |
tree | 0419f7eb42b0647a47d71ba3615eb15ad456aa3e /widget/src/text_editor.rs | |
parent | 4155edab8d123b767ddad67e24ca2d4c50f31ece (diff) | |
download | iced-508b3fe1f1405bdb8b860d0d63e2c7adfbbd51ca.tar.gz iced-508b3fe1f1405bdb8b860d0d63e2c7adfbbd51ca.tar.bz2 iced-508b3fe1f1405bdb8b860d0d63e2c7adfbbd51ca.zip |
Introduce `Kind` in `core::clipboard`
Diffstat (limited to 'widget/src/text_editor.rs')
-rw-r--r-- | widget/src/text_editor.rs | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/widget/src/text_editor.rs b/widget/src/text_editor.rs index cbcab1eb..50f7fabb 100644 --- a/widget/src/text_editor.rs +++ b/widget/src/text_editor.rs @@ -1,4 +1,5 @@ //! Display a multi-line text input for text editing. +use crate::core::clipboard::{self, Clipboard}; use crate::core::event::{self, Event}; use crate::core::keyboard; use crate::core::keyboard::key; @@ -10,7 +11,7 @@ use crate::core::text::highlighter::{self, Highlighter}; use crate::core::text::{self, LineHeight}; use crate::core::widget::{self, Widget}; use crate::core::{ - Clipboard, Element, Length, Padding, Pixels, Rectangle, Shell, Size, Vector, + Element, Length, Padding, Pixels, Rectangle, Shell, Size, Vector, }; use std::cell::RefCell; @@ -448,17 +449,19 @@ where } Update::Copy => { if let Some(selection) = self.content.selection() { - clipboard.write(selection); + clipboard.write(clipboard::Kind::Standard, selection); } } Update::Cut => { if let Some(selection) = self.content.selection() { - clipboard.write(selection.clone()); + clipboard.write(clipboard::Kind::Standard, selection); shell.publish(on_edit(Action::Edit(Edit::Delete))); } } Update::Paste => { - if let Some(contents) = clipboard.read() { + if let Some(contents) = + clipboard.read(clipboard::Kind::Standard) + { shell.publish(on_edit(Action::Edit(Edit::Paste( Arc::new(contents), )))); |