diff options
author | 2023-09-16 15:40:16 +0200 | |
---|---|---|
committer | 2023-09-16 15:40:16 +0200 | |
commit | d051f21597bb333ac10183aaa3214a292e9aa365 (patch) | |
tree | 0735e31bae1fefcf004ebba199bd5ec759040605 /graphics | |
parent | c6d0443627c22dcf1576303e5a426aa3622f1b7d (diff) | |
download | iced-d051f21597bb333ac10183aaa3214a292e9aa365.tar.gz iced-d051f21597bb333ac10183aaa3214a292e9aa365.tar.bz2 iced-d051f21597bb333ac10183aaa3214a292e9aa365.zip |
Implement `Copy` and `Paste` actions for `text::Editor`
Diffstat (limited to 'graphics')
-rw-r--r-- | graphics/src/text/editor.rs | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/graphics/src/text/editor.rs b/graphics/src/text/editor.rs index 1e375a25..1890cb82 100644 --- a/graphics/src/text/editor.rs +++ b/graphics/src/text/editor.rs @@ -398,6 +398,17 @@ impl editor::Editor for Editor { editor .action(font_system.raw(), cosmic_text::Action::Insert(c)); } + Action::Paste(text) => { + editor.insert_string(&text, None); + + // TODO: Fix cosmic-text + // Cursor should be marked as moved after `insert_string`. + let cursor = editor.cursor(); + + editor + .buffer_mut() + .shape_until_cursor(font_system.raw(), cursor); + } Action::Enter => { editor.action(font_system.raw(), cosmic_text::Action::Enter); } |