That’s such a weird & specific behavior, I don’t see the benefit…
I know some languages have a mandatory first line, so you might have random code as your unsaved tab title in those scenarios, but I think in most cases it would be useful to maintain the first-line tab naming. Having any number of
untitled tabs is a bad UI move when they could just as easily use an existing feature for differentiation.
It’s easy enough to work around, but it would be nice to just be able to type it in without wondering why it works in some cases and not others ( for people who aren’t digging into the source code ).
import sublime, sublime_plugin
class NameUnsavedTabCommand( sublime_plugin.TextCommand ):
def run( self, edit ):
window = sublime.active_window()
file = self.view.file_name()
if file == None:
window.show_input_panel ( "Enter Tab Name", "", get_TabName, None, None )
def get_TabName( userInput ):
view = sublime.active_window().active_view()
unsavedTab_Prefix = "* "
unsavedTab_Suffix = " *"
view.set_name( unsavedTab_Prefix + userInput + unsavedTab_Suffix )