n1k0 / SublimeHighlight

A humble SublimeText package for exporting highlighted code as RTF or HTML

Home Page:https://github.com/n1k0/SublimeHighlight

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Multiple clipboard options redundant or confusing in Windows?

schmod opened this issue · comments

The win32 port currently exposes two separate commands to copy highlighted text as HTML or RTF. Most of the time, this is a needless and arbitrary distinction. I propose that we [talk about] combining them.

The Windows clipboard can store multiple versions of the same content, and allow the "pasting" application to specify the format that it prefers, to most closely match its own capabilities (WordPad will prefer RTF over HTML; Outlook will accept either).

Given that this functionality exists, it seems as though we could combine the two copy commands, put both HTML and RTF on the clipboard, and allow the system to determine the "better" version to paste. While Pygments' RTF and HTML output is not 100% equivalent, it's usually pretty close, and I'm not sure that we need to expose this distinction to our users.

Also, a word on plaintext...

We also need to talk about how we handle plaintext. Currently, SublimeHighlight passes the unformatted source text to the clipboard as the highlighted text's plaintext equivalent. This likely makes sense for most users, as the copied code can be pasted into a text editor without being mangled. It also allows our 'Copy Highlighted Text' command to be used as a drop-in substitute for Sublime's built-in 'Copy' command.

However, some users will likely want to access Pygments' raw output, and paste it into a text editor (ie. if they're authoring HTML in a text editor). What's the most elegant way to deal with that scenario?

As far as I see it, the benefits/drawbacks to combining the two commands are:

Pros

  • Simple and consistent experience for Windows users.
  • Pygments' RTF and HTML output is somewhat equivalent.
  • Most applications are able to determine the "better" option when both RTF and HTML are available.

Cons

  • Creates an inconsistent cross-platform experience. (The OS X pasteboard has similar functionality, but it's not implemented in this extension)
  • Makes assumptions that might not be valid for all users. Somebody might really prefer RTF over HTML...
  • Handling of plaintext remains ambiguous.

I don't have strong opinions one way or the other, but the current state of affairs seems somewhat unsatisfactory. How can we provide a flexible experience without adding too much feature bloat?