 
     @editor.getSession().setWrapLimitRange limit, limit
     @editor.renderer.setPrintMarginColumn margin
-    @setUseWordWrap no if value is "off"
+    @setUseWordWrap no if value is 'off'
 
     return  unless save
     @appStorage.setValue 'softWrap', value


  saveFinished:(err, res)->
    unless err
      @notify "Successfully saved!", "success"
      @lastSavedContents = @lastContentsSentForSave
      @emit "FileContentSynced"
      # unless @askedForSave
        # log "this file has changed, put a modal and block editing @fatihacet!"
        # fatihacet - this case works buggy.
      @askedForSave = no
    else if err?.message?.indexOf? "permission denied" > -1
      @notify "You don't have enough permission to save!", "error"

  saveAsFinished:->
    @emit "FileContentSynced"
    @emit "FileHasBeenSavedAs", @getData()

  setEditorListeners:->

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

    {enableShortcuts, createFindAndReplaceView} = @getOptions()

    if enableShortcuts
      @addKeyCombo "save",       "Ctrl-S",           @bound "requestSave"
      @addKeyCombo "fullscreen", "Ctrl-Enter", =>    @getDelegate().toggleFullscreen()
      @addKeyCombo "gotoLine",   "Ctrl-G",           @bound "showGotoLine"
      @addKeyCombo "gotoLineL",  "Ctrl-L",           @bound "showGotoLine"
      @addKeyCombo "saveAll",    "Ctrl-Alt-S",       @bound "saveAllFiles"
      @addKeyCombo "settings",   "Ctrl-,",           noop # override default ace settings view

      if createFindAndReplaceView
        @addKeyCombo "find",    "Ctrl-F", =>        @showFindReplaceView no
        @addKeyCombo "replace", "Ctrl-Shift-F", =>  @showFindReplaceView yes
      else
        @addKeyCombo "find",    "Ctrl-F", =>        @emit 'FindAndReplaceViewRequested', no
        @addKeyCombo "replace", "Ctrl-Shift-F", =>  @emit 'FindAndReplaceViewRequested', yes

      # these features are broken with IDE, should reimplement again
      # @addKeyCombo "saveAs",     "Ctrl-Shift-S",     @bound "requestSaveAs"

  prepareSyncListeners: ->
    {localSync} = KD.singletons

    localSync.on 'LocalContentSynced', (file) =>
      @notify 'File synced to remote...', null, null, 5000

    localSync.on 'LocalContentCouldntSynced', (file) =>
      @notify 'File coudn\'t be synced to remote please try again...', null, null, 5000

  requestSaveAs: (options) ->
    contents = @getContents()
    @emit 'ace.requests.saveAs', contents

  fetchContents:(callback)->
    file = @getData()
    unless /localfile:/.test file.path
      @notify 'Loading...', null, null, 10000
      file.fetchContents callback
      {vmName, path} = file
      FSHelper.getInfo FSHelper.plainPath(path), vmName, (err, info)=>
        return if err or not info
        @emit 'FileIsReadOnly'  unless info.writable
    else
      callback null, file.contents or ''

  ###
  GETTERS
