mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-25 02:40:49 +00:00
The clipboard cannot reasonably contain the empty string. The clipboard can be empty (i.e. cleared), sure, but that this check was about whether the clipboard contained the empty string. This cannot easily happen for two reasons: - TextEditor GUI elements disable their copy actions when the selection is empty. - Clipboard::set_data, through which all text-copying operates, implicitly forbids empty strings, because Process::sys$anon_create forbids empty anonymous files. - Even if it were sent (e.g. by creating a non-empty anonymous file and sending it manually to the Clipboard server), it would not be received, because decode(Decoder&, Core::AnonymousBuffer&) goes through mmap() with a size of 0, which also is forbidden by the Kernel. In other words, if the clipboard is never the empty text, therefore checking this condition is pointless, and we can save a roundtrip to the Clipboard server.
71 KiB
71 KiB