         for i in [0..columns-1]
            newtext = justify[i][0] + '-'.repeat((widths[i]-2)) + justify[i][justify[i].length-1]
            formattedformatline.push(newtext)
-        #formatline = '|' + formattedformatline.join('|') + '|'
 
         if @keepFirstAndLastPipes
             formatline = '|' + formattedformatline.join('|') + '|'

module.exports =
class TableFormatter
    subscriptions: []
    #regex: /((.+?)\|)+?(.+)?\r?\n(([:\-\|]+?)\|)+?([:\-\|]+)?[ ]*(\r?\n((.+?)\|)+?(.+)?)+/mg

    constructor: ->
      @subscriptions = new CompositeDisposable

        @subscriptions.dispose()

    format: (editor,force) ->
        if editor.getGrammar().scopeName != 'source.gfm'
            return

        selectionsRanges = editor.getSelectedBufferRanges()

        if force or (selectionsRanges[0].isEmpty() and @autoSelectEntireDocument)
            selectionsRanges = [editor.getBuffer().getRange()]

        myIterator = (obj) =>
            obj.replace(@formatTable(obj.match))

        for range in selectionsRanges
            editor.backwardsScanInBufferRange(@regex, range, myIterator)

    formatTable: (text) ->
