bordaigorl / sublime-non-text-files

Sublime Text plugin to open files with external apps and prevent preview of binary files
22 stars 5 forks source link

Cant right click non text files #2

Closed WillyWinkel closed 8 years ago

WillyWinkel commented 8 years ago

I have pdf as open externally, but overtime I try to right click this very pdf (example to rename it, it opens and I can't change the name). Am I doing it wrong?

Best regards and many thanks for the plugin by the way Willy

bordaigorl commented 8 years ago

Hi, thanks for reporting this.

First, due to current API limitations on ST3's part, the plugin cannot detect if the file was selected with a right or left click. Even double-click is detected in a roundabout way.

Second, the context-menu behaviour in conjuction with opening the file externally is OS dependent I think (it depends on how the OS manages an open context-menu while other programs are getting the focus). On Ubuntu what I get is that after the external program has launched I can still see and click on the context-menu, so rename works just fine for me, even if it requires me to give focus back to ST before I can continue.

Note to self Maybe a workaround: define a no-op command that gets associated to a sidebar menu entry. Its is_visible method (always returning False) has some side-effect that signals to the open externally command that it should pass this time because this was a right-click. Whether this works depends on the order of execution between opening the view and querying the commands for is_visible.

bordaigorl commented 8 years ago

I implemented the workaround in my previous comment. @WillyWinkel could you test it on your system? (it is not a released change, you'll need to clone/download install the plugin manually)

WillyWinkel commented 8 years ago

Thanks for your fast reply! I am not so much into sublime, so can u explain to me in detail how to implement this fix? Ty

bordaigorl commented 8 years ago

Ok, I'll release the fix as a new release, just update the package through Package Control.

WillyWinkel commented 8 years ago

Works like a charm!