https://bugs.kde.org/show_bug.cgi?id=511989
--- Comment #8 from [email protected] --- Ok so I've noticed two things after further digging: 1. Whenever I set mime_types in SetSelection, I will only ever get requests for "text/plain" in SelectionTransfer. This limits writing to the clipboard to only ASCII characters. Reading from the clipboard on the other hand seems to work as expected, I have no issues reading utf-8 strings with "text/plain;charset=utf-8". 2. In my SelectionWrite reponse-handler, whatever I am writing into the FD will get repeated (seemingly arbitrarily) many times. I thought this might have something to do with missing a null-terminator, but including one does not really fix the issue. So for example, here is some sample code of trying to write "ab" to the clipboard: > int written; > int remaining; > const char* data; > > char s[] = { 97, 98, '\0' }; > remaining = 3; > data = s; > > while (remaining > 0) { > written = write(fd, data, remaining); > > if (written < 0) { > vlog.error("Error writing to fd: %s", strerror(errno)); > selectionWriteDone(serial, false); > g_object_unref(fdList); > close(fd); > return; > } > > remaining -= written; > data += written; > } > > if (close(fd) != 0) { > vlog.error("Failed to close fd: %s", strerror(errno)); > selectionWriteDone(serial, false); > } else { > selectionWriteDone(serial, true); > } If I include the null-terminator (remaining = 3) and try to paste into Konsole, I get a Confirm Paste warning with between ~3k and 100k characters of repeated "ab", and a warning about pasting hidden control characters U+0000. Pasting with the null character will simply paste "ab" to the terminal. If I don't include the null-terminator (remaining = 2), I still get the Confirm Paste warning with ~3-100k characters. Note that the number of characters printed (~3-100k) will differ between each paste, and not between every time I write to the clipboard. Maybe this bug should be closed, and a new one opened for this issue? Or would you prefer to keep it here? -- You are receiving this mail because: You are watching all bug changes.
