SublimeText / Origami

Split the window however you like! Create new panes, delete panes, move and clone views from pane to pane.
MIT License
1.21k stars 82 forks source link

auto_zoom_on_focus doesn't play nice with widget plugins #148

Open dyereh opened 5 years ago

dyereh commented 5 years ago

Hi - I really like the auto_zoom_on_focus feature but have found that it doesn't work with widget plugins such as terminus. I believe it is due to this bit of code:

if view.settings().get("is_widget"):
    return

Any way we this feature could be made to work in widgets such as terminus?

adzenith commented 5 years ago

Just to clarify - you're saying that you want terminus to resize when it gets focus? I'm not sure if the API allows resizing widgets.

dyereh commented 5 years ago

Yup that's it - will see if I can get it to work and let ya know

dyereh commented 5 years ago

Yup just tested - by deleting those two lines terminus will also resize. I'm curious why these were there to begin with. Did you not want widgets resizing?

This is a fantastic feature particularly when I switch to a single monitor and don't have as much real-estate but don't wanna change my pane layout

dyereh commented 5 years ago

I also found it useful to be able to toggle the auto_zoom_on_focus feature on and off from a keybinding. Not sure if this is a useful thing to include in the plugin. Right now I just have a little bit of code to wrap it

  { "keys": ["Z"], "command": "toggle_plugin_setting", "args": {"file": "Origami.sublime-settings", "key": "auto_zoom_on_focus", "toggleValue1": false, "toggleValue2":0.5 } },
import sublime, sublime_plugin

## Toggle a setting for any plugin
class TogglePluginSetting(sublime_plugin.ApplicationCommand):
    toggle = 0

    def run(self, file, key, toggleValue1, toggleValue2):
        print(self.toggle)
        settings = sublime.load_settings(file)

        if self.toggle == 0:
            value = toggleValue1
        else:
            value = toggleValue2

        settings.set(key, value)
        sublime.save_settings(file)

        self.toggle = (self.toggle + 1) % 2

I could work on this feature in at some point if you found it useful.. otherwise this plugin works just fine for my personal use

juliangarnier commented 2 weeks ago

+1, being able to resize the pane containing a terminus instance would be great.