<commit_before>class IDE.EditorPane extends IDE.Pane

  shortcutsShown = no

  constructor: (options = {}, data) ->

    options.cssClass = KD.utils.curry 'editor-pane', options.cssClass
    options.paneType = 'editor'

    {file}       = options
    @file        = file
    @lineWidgets = {}

    super options, data

    @hash  = file.paneHash  if file.paneHash

    @on 'SaveRequested', @bound 'save'

    @createEditor()

    file.once 'fs.delete.finished', =>
      KD.getSingleton('appManager').tell 'IDE', 'handleFileDeleted', file

    @once 'RealTimeManagerSet', @bound 'setContentFromCollaborativeString'
    @once 'RealTimeManagerSet', @bound 'listenCollaborativeStringChanges'


  createEditor: ->

    {file, content} = @getOptions()

    unless file instanceof FSFile
      throw new TypeError 'File must be an instance of FSFile'

    unless content?
      throw new TypeError 'You must pass file content to IDE.EditorPane'

    aceOptions =
      delegate                 : @getDelegate()
      createBottomBar          : no
      createFindAndReplaceView : no

    @addSubView @aceView = new AceView aceOptions, file

    {ace} = @aceView

    ace.once 'ace.ready', =>
      @getEditor().setValue content, 1
      ace.setReadOnly yes  if @getOptions().readOnly
      @bindChangeListeners()
      @emit 'EditorIsReady'

      KD.singletons.appManager.tell 'IDE', 'setRealTimeManager', this


  handleAutoSave: ->

    return   if @getFile().path.indexOf('localfile:/') > -1
    @save()  if @getAce().isContentChanged()


  save: ->

    @getAce().emit 'ace.requests.save', @getContent()


  getAce: ->

    return @aceView.ace


  getEditor: ->
<commit_msg>EditorPane: Get permission state and apply.<commit_after>class IDE.EditorPane extends IDE.Pane

  shortcutsShown = no

  constructor: (options = {}, data) ->

    options.cssClass = KD.utils.curry 'editor-pane', options.cssClass
    options.paneType = 'editor'

    {file}       = options
    @file        = file
    @lineWidgets = {}

    super options, data

    @hash  = file.paneHash  if file.paneHash

    @on 'SaveRequested', @bound 'save'

    @createEditor()

    file.once 'fs.delete.finished', =>
      KD.getSingleton('appManager').tell 'IDE', 'handleFileDeleted', file

    @once 'RealTimeManagerSet', @bound 'setContentFromCollaborativeString'
    @once 'RealTimeManagerSet', @bound 'listenCollaborativeStringChanges'


  createEditor: ->

    {file, content} = @getOptions()

    unless file instanceof FSFile
      throw new TypeError 'File must be an instance of FSFile'

    unless content?
      throw new TypeError 'You must pass file content to IDE.EditorPane'

    aceOptions =
      delegate                 : @getDelegate()
      createBottomBar          : no
      createFindAndReplaceView : no

    @addSubView @aceView = new AceView aceOptions, file

    {ace} = @aceView

    ace.once 'ace.ready', =>
      @getEditor().setValue content, 1
      ace.setReadOnly yes  if @getOptions().readOnly
      @bindChangeListeners()
      @emit 'EditorIsReady'

      KD.singletons.appManager.tell 'IDE', 'setRealTimeManager', this

      @once 'RealTimeManagerSet', =>
        myPermission = @rtm.getFromModel('permissions').get KD.nick()
        @makeReadOnly()  if myPermission is 'read'


  handleAutoSave: ->

    return   if @getFile().path.indexOf('localfile:/') > -1
    @save()  if @getAce().isContentChanged()


  save: ->

    @getAce().emit 'ace.requests.save', @getContent()


  getAce: ->

    return @aceView.ace


  getEditor: ->

{'fraction_non_alphanumeric': 0.11824611032531825, 'fraction_numerical': 0.0011315417256011315, 'mean_word_length': 2.8602620087336246, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 22, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1449823', 'n_tokens_mistral': 1138, 'n_tokens_neox': 1054, 'n_words': 261}