Home Download Buy Blog Forum Support

Copy Edit - fix multiple selection copy/paste

Re: Copy Edit - fix multiple selection copy/paste

Postby adzenith on Mon Jun 10, 2013 2:44 pm

Turns out the clipboard solution works just fine... but Sublime Text sets the default encoding to ascii (??!!) so that the subprocess communication breaks when communicating with the clipboard helpers. Anyone know how to fix that?
adzenith
 
Posts: 1214
Joined: Mon Oct 19, 2009 9:12 pm

Re: Copy Edit - fix multiple selection copy/paste

Postby adzenith on Mon Jun 10, 2013 2:58 pm

This is awful. Seriously, does anyone know why pyperclip would work just fine in the terminal and literally everywhere but in Sublime Text? ST, why do you have to mess with python so much... it works just fine normally...
adzenith
 
Posts: 1214
Joined: Mon Oct 19, 2009 9:12 pm

Re: Copy Edit - fix multiple selection copy/paste

Postby facelessuser on Mon Jun 10, 2013 3:47 pm

adzenith wrote:Turns out the clipboard solution works just fine... but Sublime Text sets the default encoding to ascii (??!!) so that the subprocess communication breaks when communicating with the clipboard helpers. Anyone know how to fix that?


Pester Jon to compile it to use unicode :). Not sure if there is some other way. I plan on playing with your plugin this week. But while I say to pester Jon half jokingly....I am also half serious.
facelessuser
 
Posts: 1567
Joined: Tue Apr 05, 2011 7:38 pm

Re: Copy Edit - fix multiple selection copy/paste

Postby adzenith on Mon Jun 10, 2013 6:55 pm

Well as far as I can tell, everything works just fine as long as you don't copy unicode, and the clipboard handler I'm using works just fine with unicode as long as you're not using Sublime Text. Just in case you want to take a look :)
adzenith
 
Posts: 1214
Joined: Mon Oct 19, 2009 9:12 pm

Re: Copy Edit - fix multiple selection copy/paste

Postby icylace on Tue Jun 11, 2013 6:39 am

Perhaps use decode() on strings ?
http://effbot.org/zone/unicode-objects.htm
icylace
 
Posts: 48
Joined: Mon Jan 14, 2013 7:24 am

Re: Copy Edit - fix multiple selection copy/paste

Postby adzenith on Tue Jun 11, 2013 2:53 pm

Well, here's what happens, as far as I can tell. If I call string.encode('utf-8') or whatever, then if I paste into a different application it comes out garbled - I guess the system clipboard isn't utf-8? So somehow I need to be detecting what the system clipboard's encoding is, or convince the clipboard to be utf-8, or I don't know what.

But! If I use the same clipboard module from anywhere that's not Sublime, I don't need to call string.encode at all—it just works (except in Sublime Text, where it flips out when I paste - "can't decode to ascii" by default, or garbles it if I try to decode as utf-8).

A lot of Googling and messing around with the code and I have gotten no further.
adzenith
 
Posts: 1214
Joined: Mon Oct 19, 2009 9:12 pm

Re: Copy Edit - fix multiple selection copy/paste

Postby tito on Wed Jun 12, 2013 4:24 am

I did not reviewed completely the code of this package, but, there is two api functions to read and write to clipboard, not sure if there is a good reason to do it in python. If there is a good reason just ignore my post, if not why don't use the sublime API calls?
Thanks for this plugin, is useful
Give APIs, let the community build the rest!
https://github.com/titoBouzout
tito
 
Posts: 854
Joined: Thu Sep 29, 2011 2:27 pm
Location: Montevideo, Uruguay

Re: Copy Edit - fix multiple selection copy/paste

Postby adzenith on Wed Jun 12, 2013 6:02 pm

tito wrote:...there is two api functions to read and write to clipboard...

...Well I'll be.
adzenith
 
Posts: 1214
Joined: Mon Oct 19, 2009 9:12 pm

Re: Copy Edit - fix multiple selection copy/paste

Postby facelessuser on Wed Jun 12, 2013 6:06 pm

adzenith wrote:
tito wrote:...there is two api functions to read and write to clipboard...

...Well I'll be.

That's funny, for some reason I didn't even think about the API copy/paste...and I have used it in some of my plugins...if it were a snake...
facelessuser
 
Posts: 1567
Joined: Tue Apr 05, 2011 7:38 pm

Re: Copy Edit - fix multiple selection copy/paste

Postby adzenith on Wed Jun 12, 2013 6:09 pm

Pushed it real good.
Looks to be 100% now. I can copy and paste Unicode to my heart's content.
Tito: you rock.
adzenith
 
Posts: 1214
Joined: Mon Oct 19, 2009 9:12 pm

PreviousNext

Return to Plugin Announcements

Who is online

Users browsing this forum: No registered users and 7 guests