1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 05:08:13 +00:00

FileManager+LibGUI+Userland: Switch clipboard to MIME types

We will now actually use MIME types for clipboard. The default type is now
"text/plain" (instead of just "text").

This also fixes some issues in copy(1) and paste(1).
This commit is contained in:
Sergey Bugaev 2020-05-15 22:35:03 +03:00 committed by Andreas Kling
parent de7827faf7
commit acc107a44f
4 changed files with 27 additions and 19 deletions

View file

@ -46,11 +46,16 @@ int main(int argc, char* argv[])
auto& clipboard = GUI::Clipboard::the();
auto data_and_type = clipboard.data_and_type();
if (data_and_type.type.is_null()) {
fprintf(stderr, "Nothing copied\n");
return 1;
}
if (!print_type) {
printf("%s", data_and_type.data.characters());
// Append a newline to text contents, but
// only if we're not asked not to do this.
if (data_and_type.type == "text" && !no_newline)
if (data_and_type.type == "text/plain" && !no_newline)
putchar('\n');
} else {
printf("%s\n", data_and_type.type.characters());