Implement Copy and Paste actions for text::Editor
This commit is contained in:
parent
c6d0443627
commit
d051f21597
4 changed files with 24 additions and 5 deletions
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue