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:
parent
de7827faf7
commit
acc107a44f
4 changed files with 27 additions and 19 deletions
|
@ -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());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue