       return
 
     if @isTrimWhiteSpacesEnabled
-      @trimTrailingWhitespaces()
+      @trimTrailingWhitespaces options.ignoreActiveLineOnTrim
       contents = @getContents()
 
     @askedForSave = yes


    @editor.getSession().selection.on 'changeCursor', (cursor) =>
      return if @suppressListeners
      @emit 'ace.change.cursor', @editor.getSession().getSelection().getCursor()

    @editor.commands.on 'afterExec', (e) =>
      if e.command.name is 'insertstring' and /^[\w.]$/.test e.args

    @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: ->
