mirror of
https://github.com/atom/atom.git
synced 2026-02-09 22:24:59 -05:00
Status bar renders current path and buffer position on initialization
This commit is contained in:
@@ -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}")
|
||||
|
||||
Reference in New Issue
Block a user