docs.sublimetext.io icon indicating copy to clipboard operation
docs.sublimetext.io copied to clipboard

Explain the difference between is_visible and is_enabled when implementing a {Application,Window,Text}Command

Open rwols opened this issue 5 years ago • 2 comments

I keep forgetting what the differences are. And what the exact effects are. The ST3 docs are pretty much useless in this regard.

rwols avatar Jul 19 '20 20:07 rwols

I believe it is kinda dependent. In case if the command is registered in the command palette, then both of them have the same behavior i.e. the command doesn't show up if you search for it via the caption. (if you return False that is)

If it's a menu entry, then is_enabled returning False will gray out & disable the menu entry. is_visible returning False will not make it appear in the menu at all.

If it is a key binding, then is_visible has no effect. is_enabled returning False on the other hand will not make the command execute via the binding.

In case of mousemap files also, is_visible has no effect. is_enabled returning False will disable that button from executing the command or press_command (provided the said command/press_command has is_enabled returning False)

UltraInstinct05 avatar Jul 20 '20 03:07 UltraInstinct05

Sounds like a pull-request ;)

rwols avatar Jul 20 '20 07:07 rwols