Window's title matches TextMate pattern of "#{basename} – #{project.path}"

This commit is contained in:
Corey Johnson
2012-11-15 17:08:37 -08:00
parent 765fedaf42
commit 5bdfc49f3f
3 changed files with 27 additions and 14 deletions

View File

@@ -47,7 +47,6 @@ class RootView extends View
@extensions = {}
@project = new Project(pathToOpen)
@handleEvents()
@setTitle()
@loadUserConfiguration()
if pathToOpen
@@ -68,7 +67,7 @@ class RootView extends View
@getActiveEditor().focus()
false
else
@setTitle(@project?.getPath())
@setTitle(null)
focusableChild = this.find("[tabindex=-1]:visible:first")
if focusableChild.length
focusableChild.focus()
@@ -78,7 +77,10 @@ class RootView extends View
@on 'active-editor-path-change', (e, path) =>
@project.setPath(path) unless @project.getRootDirectory()
@setTitle(path)
if path
@setTitle(fs.base(path))
else
@setTitle("untitled")
@command 'window:increase-font-size', => @setFontSize(@getFontSize() + 1)
@command 'window:decrease-font-size', => @setFontSize(@getFontSize() - 1)
@@ -176,10 +178,21 @@ class RootView extends View
keymap.bindingsForElement(document.activeElement)
getTitle: ->
@title or 'untitled'
@title or "untitled"
setTitle: (title='untitled') ->
@title = document.title = title
setTitle: (title) ->
projectPath = @project.getPath()
if not projectPath
@title = "untitled"
else if title
@title = "#{title} #{projectPath}"
else
@title = projectPath
@updateWindowTitle()
updateWindowTitle: ->
document.title = @title
setShowInvisibles: (showInvisibles) ->
return if @showInvisibles == showInvisibles