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

Doesn't work for JPGs #1

Closed depressiveRobot closed 9 years ago

depressiveRobot commented 9 years ago

Hello!

I just stumbled over your plugin, exactly what I want! :+1:

Unfortunately, I doesn't work for me. Here is my configuration:

"prevent_bin_preview": true,
"binary_file_patterns": [
    "*.jpg",
    "*.jpeg",
    "*.png",
    "*.gif",
    "*.zip",
    "*.pdf",
    "*.war"
],
"open_externally_patterns": [
    "*.jpg",
    "*.jpeg",
    "*.png",
    "*.gif",
    "*.zip",
    "*.pdf"
],

When clicking on a WAR file, it still tries to open it. Same for JPGs etc.

OS X 10.10.5 Sublime Text Build 3083

bordaigorl commented 9 years ago

Any error message in the console? I'll have a look this evening, thanks for the report. BTW I only tested this for Linux but I'd happily try to make it work for OS X and PR are most welcome :wink:

depressiveRobot commented 9 years ago

There is no output in the console when selecting the WAR file...

Is there a way to see if your plugins gets triggered?

bordaigorl commented 9 years ago

One thing worth mentioning: the plugin closes the preview for bin files the first time you open them, but the second time in a row that the same file is opened it does not close it. This is on purpose, as to simulate "double-click forces open".

bordaigorl commented 9 years ago

@depressiveRobot I tested the plugin on a MacBook pro and it seems to work ok. Can you see if there are exceptions in the ST console when the plugin gets loaded (at the beginning of the console's output there's a list of all plugins loaded). To see if the plugin is triggered you can add a print statement at the beginning of on_load.

BTW I am committing some new changes that affect the "double-click" behaviour I was refering to in the previous post.

depressiveRobot commented 9 years ago

Ok, reinstalled. Now it works for PDF files and WAR archives. But JPGs still opened in the editor.

bordaigorl commented 9 years ago

Ah yes, JPGs are opened by ST3 automatically (this is a new feature not present in ST2). ST3 bypasses EventListeners of any plugin when opening images and this is why the plugin does not have the chance of triggering. Even more sadly, image preview views return None as file_name() so even the open_externally command will not work on them.

depressiveRobot commented 9 years ago

Have you opened an issue for that?

bordaigorl commented 9 years ago

Just did :wink: SublimeTextIssues/Core#986

depressiveRobot commented 9 years ago

:+1: