diff options
author | Sergey Bugaev <bugaevc@serenityos.org> | 2020-05-15 22:35:03 +0300 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-05-16 09:11:46 +0200 |
commit | acc107a44feadcaec5ecfc6fded97fb1a3421132 (patch) | |
tree | d7c17f75fb4d158a0665e70cb7900fed00aa8384 /Userland/paste.cpp | |
parent | de7827faf7decb93268c55da022721b6e2cf0904 (diff) | |
download | serenity-acc107a44feadcaec5ecfc6fded97fb1a3421132.zip |
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).
Diffstat (limited to 'Userland/paste.cpp')
-rw-r--r-- | Userland/paste.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/Userland/paste.cpp b/Userland/paste.cpp index 8c60168ec1..b5eb2ab5d2 100644 --- a/Userland/paste.cpp +++ b/Userland/paste.cpp @@ -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()); |