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

Copy to clipboard as rtf stores raw data only - WINDOWS

rorysmyth opened this issue · comments

Whenever I used the copy to clipboard as rtf and paste into an application like word or powerpoint, it pastes as raw, unformatted data.

Same (Windows 8)

Yeah, there's no Windows support for RTF pasting atm, because I'm not aware of any Windows tool to achieve it. But any patch is welcome :)

I've just found http://code.activestate.com/recipes/474121-getting-html-from-the-windows-clipboard/, if somebody with a vindows box/vm want to play with it and submit a patch, go :)

Just issued a pull request for this. RTF and HTML should now get stored on the clipboard in the correct formats, with a plaintext fallback for apps that don't support rich text.

I'm implemented this using ctypes, and interacted directly with the Windows API. Most existing libraries for this purpose had a huge overhead, and didn't handle HTML elegantly. Given that we just need to copy two formats, it seemed easiest to do this as directly as possible.

(Be kind. I've never written a line of Python in my life prior to yesterday.)

Be kind. I've never written a line of Python in my life prior to yesterday.

@schmod No pb it's already great you took the time to write & send a PR, thank you! I've made some comments on your code, take it easy :)

Thanks for the helpful suggestions!

Time to close this up?

Ah yeah, sure :)

doesn't work in Win8.. i click on Copy as but nothing is stored in the clipboard