1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-28 22:15:07 +00:00

LibGUI: Make the Clipboard API deal in raw byte buffers a bit more

To open up for putting not just text/plain content on the clipboard,
let's make the GUI::Clipboard API a bit more raw-data-friendly. :^)
This commit is contained in:
Andreas Kling 2020-09-05 16:16:01 +02:00
parent 802f541184
commit 51146e3075
12 changed files with 43 additions and 38 deletions

View file

@ -1300,7 +1300,7 @@ void TextEditor::cut()
return;
auto selected_text = this->selected_text();
printf("Cut: \"%s\"\n", selected_text.characters());
Clipboard::the().set_data(selected_text);
Clipboard::the().set_plain_text(selected_text);
delete_selection();
}
@ -1308,7 +1308,7 @@ void TextEditor::copy()
{
auto selected_text = this->selected_text();
printf("Copy: \"%s\"\n", selected_text.characters());
Clipboard::the().set_data(selected_text);
Clipboard::the().set_plain_text(selected_text);
}
void TextEditor::paste()
@ -1317,7 +1317,7 @@ void TextEditor::paste()
return;
auto paste_text = Clipboard::the().data();
printf("Paste: \"%s\"\n", paste_text.characters());
printf("Paste: \"%s\"\n", String::copy(paste_text).characters());
TemporaryChange change(m_automatic_indentation_enabled, false);
insert_at_cursor_or_replace_selection(paste_text);