{View} = require 'atom'

module.exports =
class CursorPositionView extends View
  @content: ->
    @div class: 'cursor-position inline-block'

  initialize: (@statusBar) ->
    @subscribe @statusBar, 'active-buffer-changed', @updateCursorPositionText
    @subscribe atom.workspaceView, 'cursor:moved', @updateCursorPositionText

  destroy: ->
    @remove()

  afterAttach: ->
    @updateCursorPositionText()

  updateCursorPositionText: =>
    editor = atom.workspace.getActiveEditor()
    if position = editor?.getCursorBufferPosition()
      @text("#{position.row + 1},#{position.column + 1}").show()
    else
      @hide()

{View} = require 'atom'

module.exports =
class CursorPositionView extends View
  @content: ->
    @div class: 'cursor-position inline-block', =>
      @span outlet: 'cursorPosition'

  initialize: (@statusBar) ->
    @subscribe @statusBar, 'active-buffer-changed', @updateCursorPositionText
    @subscribe atom.workspaceView, 'cursor:moved', @updateCursorPositionText

  destroy: ->
    @remove()

  afterAttach: ->
    @updateCursorPositionText()

  updateCursorPositionText: =>
    editor = atom.workspace.getActiveEditor()
    if position = editor?.getCursorBufferPosition()
      @cursorPosition.text("#{position.row + 1},#{position.column + 1}").show()
    else
      @cursorPosition.hide()

Use a span to hold the cursor position text
Use a span to hold the cursor position text

This fixes an issue where detaching and re-attaching the status bar
would cause the cursor position div not to be shown. The reason
why it wasn't shown is that it would get an inline display: block style
for some reason (overriding the display: inline-block), which breaks layout.
I'm guessing that this is a jQuery thing related to how it handles
hiding/showing DOM nodes.
