Opened 2 years ago

Last modified 2 years ago

#16746 new defect

Pasting from Lyrics Finder to Pidgin conversation doesn't work properly

Reported by: computergeoffrey@… Owned by: EionRobb
Milestone: Component: unclassified
Version: 2.10.11 Keywords:
Cc:

Description

Hi. If I copy text from Lyrics Finder HTML view to Pidgin, a CSS rule is added visibly. In other programs that process HTML to plain text CSS rules are not visible. This includes Mozilla Firefox, LibreOffice? and Geany.

Pidgin fails to handle the pasting properly, resulting in:

p, li { white-space: pre-wrap; } TEXT

TEXT TEXT

instead of TEXT TEXT TEXT

Steps to reproduce

  1. You can obtain VLC Lyrics Finder here: https://github.com/Smile4ever/VLC-Lyrics-Finder
  2. After installation, open the attached file in VLC and go to View -> Lyrics Finder.
  3. Now copy a few lines
  4. Start Pidgin
  5. Paste into a conversation
  6. Formatting error is present.

Attachments (2)

clipboard-formats.txt (4.1 KB) - added by computergeoffrey@… 2 years ago.
Log file with the clipboard formats
clipboard.py (562 bytes) - added by computergeoffrey@… 2 years ago.
Clipboard format detection script

Download all attachments as: .zip

Change History (9)

comment:1 Changed 2 years ago by computergeoffrey@…

Changed 2 years ago by computergeoffrey@…

Log file with the clipboard formats

Changed 2 years ago by computergeoffrey@…

Clipboard format detection script

comment:2 Changed 2 years ago by computergeoffrey@…

After a little testing, I have come to a conclusion.

VLC Media Player copies a few variants to the clipboard that can be used by Pidgin. Available formats are: text/plain, UTF8_STRING, STRING, TEXT, COMPOUND_TEXT and text/html

Pidgin appears to use text/html from the clipboard and strips it to keep the text. It would be less error prone to use text/plain from the clipboard. This would also fix this bug.

Please see the log with the output of the various clipboard formats. The clipboard detection script is attached too.

So it appears the CSS doesn't get stripped properly: <style type="text/css"> p, li { white-space: pre-wrap; } </style> from the clipboard's text/html gets stripped to p, li { white-space: pre-wrap; } while it should have been nothing.

comment:3 Changed 2 years ago by datallah

How would pidgin know that in this situation it's more appropriate to use the plain text rather than the formatted text?

The issue is that the CSS styling isn't supported.

Arguably the entire <style>...</style> block should have been stripped, but that's about the only thing that could be reasonably done without more major changes.

comment:4 follow-up: Changed 2 years ago by computergeoffrey@…

In reaction to comment 3: "How would pidgin know that in this situation it's more appropriate to use the plain text rather than the formatted text?"

The question should rather be: Why does Pidgin use the text/html version if it wants plain text?

In reaction to comment 3: "Arguably the entire <style>...</style> block should have been stripped, but that's about the only thing that could be reasonably done without more major changes."

Yes! That would be a good solution too.

comment:5 in reply to: ↑ 4 ; follow-up: Changed 2 years ago by datallah

Replying to computergeoffrey@…:

In reaction to comment 3: "How would pidgin know that in this situation it's more appropriate to use the plain text rather than the formatted text?"

The question should rather be: Why does Pidgin use the text/html version if it wants plain text?

There are lots of situations where formatted text works (for the subset of html formatting that's supported).

comment:6 in reply to: ↑ 5 Changed 2 years ago by computergeoffrey@…

Then the best solution would be to strip the entire style block.

comment:7 Changed 2 years ago by computergeoffrey@…

Workaround:

Put

binding "my-bindings" {

bind "<ctrl>v" { "paste" ("text") }

} widget "*pidgin_conv_entry" binding "my-bindings"

inside ~/.gtkrc-2.0 and restart Pidgin to always use plain text. Source: http://ubuntuforums.org/showthread.php?t=1571644

Note: See TracTickets for help on using tickets.
All information, including names and email addresses, entered onto this website or sent to mailing lists affiliated with this website will be public. Do not post confidential information, especially passwords!