mirror of
https://github.com/atom/atom.git
synced 2026-02-09 06:05:11 -05:00
Status bar path and cursor position updates
This commit is contained in:
@@ -21,11 +21,20 @@ class StatusBar extends View
|
||||
@div class: 'cursor-position', outlet: 'cursorPosition'
|
||||
|
||||
initialize: (@rootView, @editor) ->
|
||||
@updatePathText()
|
||||
@editor.on 'editor-path-change', => @updatePathText()
|
||||
|
||||
@updateCursorPositionText()
|
||||
@editor.on 'cursor-move', => @updateCursorPositionText()
|
||||
|
||||
updatePathText: ->
|
||||
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}")
|
||||
updateCursorPositionText: ->
|
||||
{ row, column } = @editor.getCursorBufferPosition()
|
||||
@cursorPosition.text("#{row + 1},#{column + 1}")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user