Implement Copy and Paste actions for text::Editor

This commit is contained in:
Héctor Ramón Jiménez 2023-09-16 15:40:16 +02:00
parent c6d0443627
commit d051f21597
No known key found for this signature in database
GPG key ID: 7CC46565708259A7
4 changed files with 24 additions and 5 deletions

View file

@ -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);
}