After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 611642 - No way to override text to copy from GtkTextBuffer for middle-click paste.
No way to override text to copy from GtkTextBuffer for middle-click paste.
Status: RESOLVED DUPLICATE of bug 106794
Product: gtk+
Classification: Platform
Component: Widget: GtkTextView
2.18.x
Other Linux
: Normal normal
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks: 603031
 
 
Reported: 2010-03-02 22:25 UTC by Mike Ruprecht
Modified: 2013-04-05 14:55 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Add and register a function to serialize 'text/plain' format. (3.50 KB, patch)
2010-06-16 14:59 UTC, marcoil
none Details | Review

Description Mike Ruprecht 2010-03-02 22:25:55 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.
Comment 1 soloturn 2010-04-05 18:31:28 UTC
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
Comment 2 marcoil 2010-06-16 14:59:24 UTC
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…
Comment 3 Sébastien Wilmet 2013-04-05 14:55:40 UTC

*** This bug has been marked as a duplicate of bug 106794 ***