Status bar renders current path and buffer position on initialization

This commit is contained in:
Nathan Sobo
2012-04-17 12:09:06 -06:00
parent 77ec2bbb08
commit 012237678e
2 changed files with 33 additions and 8 deletions

View File

@@ -4,16 +4,26 @@ module.exports =
class StatusBar extends View
@initialize: (rootView) ->
for editor in rootView.editors()
@appendToEditorPane(editor)
@appendToEditorPane(rootView, editor)
rootView.on 'editor-open', (e, editor) =>
@appendToEditorPane(editor)
@appendToEditorPane(rootView, editor)
@appendToEditorPane: (editor) ->
@appendToEditorPane: (rootView, editor) ->
if pane = editor.pane()
pane.append(new StatusBar(editor))
pane.append(new StatusBar(rootView, editor))
@content: ->
@div class: 'status-bar'
@div class: 'status-bar', =>
@div class: 'current-path', outlet: 'currentPath'
@div class: 'cursor-position', outlet: 'cursorPosition'
initialize: (@editor) ->
initialize: (@rootView, @editor) ->
path = @editor.buffer.path
if path
@currentPath.text(@rootView.project.relativize(path))
else
@currentPath.text('untitled')
position = @editor.getCursorBufferPosition()
@cursorPosition.text("#{position.row},#{position.column}")