 
     @editor.getSession().selection.on 'changeCursor', (cursor) =>
       return if @suppressListeners
-      @emit 'ace.change.cursor', @editor.getSession().getSelection().getCursor()
+      @emit 'ace.change.cursor', @getCursor()
 
     @editor.commands.on 'afterExec', (e) =>
       if e.command.name is 'insertstring' and /^[\w.]$/.test e.args

      return

    if @isTrimWhiteSpacesEnabled
      @trimTrailingWhitespaces()
      contents = @getContents()

    @askedForSave = yes

    @emit 'RemoveModifiedFromTab', @getData().path


  trimTrailingWhitespaces: (ignoreActiveLine) ->

    doc       = @editor.getSession().getDocument()
    lines     = doc.getAllLines()
    activeRow = @getCursor().row  if ignoreActiveLine

    for line, lineNumber in lines
      whiteSpaceIndex = line.search /\s+$/

      if whiteSpaceIndex > -1
        if activeRow?
          if activeRow isnt lineNumber
            doc.removeInLine lineNumber, whiteSpaceIndex, line.length
        else
          doc.removeInLine lineNumber, whiteSpaceIndex, line.length


  showGotoLine: ->
