GNOME Bugzilla – Bug 611642
No way to override text to copy from GtkTextBuffer for middle-click paste.
Last modified: 2013-04-05 14:55:40 UTC
A GtkTextView is being used to display text with embedded smileys/emoticons. When copy/pasting this text by selecting it and pressing the middle mouse button on a plain-text target, the smileys and other embedded objects are completely ignored. Ideally, for this usage, the smileys should be represented as their shortcuts (e.g. :-)), but there isn't really a way to override it to do that. I was thinking it could work well to use the gtk_text_buffer_register_serialize_format and register a custom function with 'text/plain' as the format. Then that custom function could be used to convert the smileys and other objects into the correct plain-text representation. I believe then other methods of copying in addition to drag-and-drop could work using this custom function as well, similar to how rich text is handled.
is this the reason why copy-paste works differently in pidgin and empathy as well? see gnome empathy bug 603031 and ubuntu bug https://bugs.edge.launchpad.net/ubuntu/+source/empathy/+bug/530222 e.g. with pidgin copy-paste looks the same everywhere. nicely formatted, with color and timestamp, one paragraph per message. with empathy it does not, some examples: 1. copy multiple messages from one chat window - paste into another the result is one big message, including all the messages as text. name and date coming with it. 2. copy multiple messages from one chat window - paste into openoffice an ugly formatted (html?) table is produced, with dead icons. 3. copy multiple messages from one chat window - paste intogmail rich text formatted mail, firefox-3.6 no paste at all is possible. 4. copy multiple messages from one chat window - paste into text editor, or text formated gmail the format is ugly and inconsistent, i.e. for a multiline message copied: * first line is name and time, * second line is only text * third line is text and time * fourth line is space
Created attachment 163833 [details] [review] Add and register a function to serialize 'text/plain' format. This patch reuses the existing code to implement a serialize function for gtk_text_buffer_register_serialize_format, but as noted in bug #603031, it doesn't work, as the function is never called. The same issue happens when drag-and-droping text from a chat window to another window. Following the code in gtk_text_view_drag_data_get it seems like the target info is not GTK_TEXT_BUFFER_TARGET_INFO_RICH_TEXT, which is necessary for the serialize function to get called. I haven't found how to change that anywhere. I've also been unable to find the code path for middle-clicking…
*** This bug has been marked as a duplicate of bug 106794 ***