<commit_before>###
  todo:

    - put search replace
    - fix setSoftWrap it goes back to off when you reopen the settings

###


class Ace extends KDView

  constructor:(options, file)->

    super options, file
    @lastSavedContents = ""
    @appStorage = new AppStorage 'Ace', '1.0'

  setDomElement:(cssClass)->

    @domElement = $ "<figure class='kdview'><div id='editor#{@getId()}' class='code-wrapper'></div></figure>"

  viewAppended:->

    @appStorage.fetchStorage (storage)=>
      log storage
      require ['ace/ace'], (ace)=>
        @editor = ace.edit "editor#{@getId()}"
        @prepareEditor()
        @utils.wait => @emit "ace.ready"
        @fetchContents (err, contents)=>
          @setContents contents if contents
          @editor.gotoLine 0

  prepareEditor:->

    @setTheme()
    @setSyntax()
    @setUseSoftTabs         @appStorage.getValue 'useSoftTabs',         yes
    @setShowGutter          @appStorage.getValue 'showGutter',          yes
    @setShowPrintMargin     @appStorage.getValue 'showPrintMargin',     no
    @setHighlightActiveLine @appStorage.getValue 'highlightActiveLine', yes
    @setShowInvisibles      @appStorage.getValue 'showInvisibles',      yes
    @setFontSize            @appStorage.getValue 'fontSize',            10
    @setTabSize             @appStorage.getValue 'tabSize',             4
    @setUseWordWrap         @appStorage.getValue 'useWordWrap',         yes
    @setSoftWrap            @appStorage.getValue 'softWrap',            'free'
    @setEditorListeners()
<commit_msg> Remove log<commit_after>###
  todo:

    - put search replace
    - fix setSoftWrap it goes back to off when you reopen the settings

###


class Ace extends KDView

  constructor:(options, file)->

    super options, file
    @lastSavedContents = ""
    @appStorage = new AppStorage 'Ace', '1.0'

  setDomElement:(cssClass)->

    @domElement = $ "<figure class='kdview'><div id='editor#{@getId()}' class='code-wrapper'></div></figure>"

  viewAppended:->

    @appStorage.fetchStorage (storage)=>
      require ['ace/ace'], (ace)=>
        @editor = ace.edit "editor#{@getId()}"
        @prepareEditor()
        @utils.wait => @emit "ace.ready"
        @fetchContents (err, contents)=>
          @setContents contents if contents
          @editor.gotoLine 0

  prepareEditor:->

    @setTheme()
    @setSyntax()
    @setUseSoftTabs         @appStorage.getValue 'useSoftTabs',         yes
    @setShowGutter          @appStorage.getValue 'showGutter',          yes
    @setShowPrintMargin     @appStorage.getValue 'showPrintMargin',     no
    @setHighlightActiveLine @appStorage.getValue 'highlightActiveLine', yes
    @setShowInvisibles      @appStorage.getValue 'showInvisibles',      yes
    @setFontSize            @appStorage.getValue 'fontSize',            10
    @setTabSize             @appStorage.getValue 'tabSize',             4
    @setUseWordWrap         @appStorage.getValue 'useWordWrap',         yes
    @setSoftWrap            @appStorage.getValue 'softWrap',            'free'
    @setEditorListeners()

{'fraction_non_alphanumeric': 0.12052117263843648, 'fraction_numerical': 0.003908794788273616, 'mean_word_length': 2.5502890173410404, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 27, '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': '1365776', 'n_tokens_mistral': 902, 'n_tokens_neox': 879, 'n_words': 204}