Skip to content

Commit

Permalink
Merge pull request atom#77 from atom/mq-line-column-tooltip
Browse files Browse the repository at this point in the history
Add tooltip to cursor position status
  • Loading branch information
mnquintana committed May 26, 2015
2 parents bb76792 + b0f4b2f commit 2847e13
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion lib/cursor-position-view.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,13 @@ class CursorPositionView extends HTMLElement

@subscribeToActiveTextEditor()

@tooltip = atom.tooltips.add(this, title: ->
"Line #{@row}, Column #{@column}")

destroy: ->
@activeItemSubscription.dispose()
@cursorSubscription?.dispose()
@tooltip.dispose()

subscribeToActiveTextEditor: ->
@cursorSubscription?.dispose()
Expand All @@ -22,7 +26,9 @@ class CursorPositionView extends HTMLElement

updatePosition: ->
if position = @getActiveTextEditor()?.getCursorBufferPosition()
@textContent = "#{position.row + 1}:#{position.column + 1}"
@row = position.row + 1
@column = position.column + 1
@textContent = "#{@row}:#{@column}"
else
@textContent = ''

Expand Down

0 comments on commit 2847e13

Please sign in to comment.