facelessuser / TabsExtra

Sublime Plugin with sticky tabs, more tab closing options, and additional menu items.
https://facelessuser.github.io/TabsExtra/
MIT License
107 stars 10 forks source link

Sticky tabs does not work with single tab close command #46

Closed ziki77 closed 7 years ago

ziki77 commented 7 years ago

A sticked tab could be closed with any single close command like ctrl+w or "Close" from right click menu' (with "persistent_sticky": true), is that the intend behaviour? I think that a sticked tab should not be closed by any command, otheriwise is not "sticked"...

facelessuser commented 7 years ago

This is well understood. There are certain commands I cannot override like clicking the x in a tab, that command does not call traditional close commands that I can override. I override all close commands but one, and that is the single file close. The idea was that if you are purposely trying to close a tab, you must want to close it. I'm not sure I agree that it is not "sticky", I just don't require a sticky tab to ignore the single file close command. If I am able to call the underlying single close command directly (the level below the close API), I might consider overriding the last single close command, but I still won't be able to intercept the tab "x" button.

I'll mark this as a "maybe" until I investigate further.

facelessuser commented 7 years ago

I can override the close_file command and call the low level API. But the "x" button can not be overridden. If that is important, if you theme allows it, you can configure hiding the "x" button.

So I will look into overriding the last close_file command.

mr-mmmmore commented 3 years ago

Should it work now? Turning a tab into sticky doesn't prevent me to close it using "cmd + w" (I'm on a mac).

Like ziki77 said, it doesn't feel sticky to me as my motivation is to prevent myself from accidentally closing the tab.

facelessuser commented 3 years ago

@mr-mmmmore This is a limitation of the Sublime API. For instance, I cannot override certain close events, like clicking the x button on a tab. It takes a path I cannot override. For consistency, a purposeful tab closes to a single tab is allowed, but when bulk closing tabs ("Close to the left/right" or "Close others") tabs will be preserved.

Previously I had something that would pop up a dialog when an attempt to close a single tab occurred asking if the user wanted to close the tab, but as I mentioned, I could only intercept some single tab close events and not others. It adds some complexity but was insufficient to catch all events.

mr-mmmmore commented 3 years ago

OK, I thought that the commit referenced above had solved the problem. Thanks anyway.