     if @limitLastColumnPadding
       sum = (arr) -> arr.reduce (x, y) -> x + y
       wsum = sum(widths)
-      if widths.length and wsum > @pll
+      if widths.length and wsum > @preferredLineLength
         prewsum = sum(widths[...-1])
-        widths[widths.length-1] = Math.max (@pll -
+        widths[widths.length - 1] = Math.max (@preferredLineLength -
           prewsum -
           widths.length - 1), 3
           # Need at least :-- for github to recognize a column

  format: (editor, force) ->
    if not (editor.getGrammar().scopeName in @markdownGrammarScopes)
      return

    @pll = atom.config.get('editor.preferredLineLength')

    selectionsRanges = editor.getSelectedBufferRanges()


      @subscriptions.add editor.getBuffer().onWillSave =>
        @format editor, true if @formatOnSave

  readConfig: (key, scope) ->
    scope ?= 'markdown-table-formatter'
    scopedKey = "#{scope}.#{key}"
    @subscriptions.add atom.config.observe scopedKey, (value) =>
      @[key] = value

  initConfig: ->
    @readConfig "autoSelectEntireDocument"
    @readConfig "spacePadding"
    @readConfig "keepFirstAndLastPipes"
    @readConfig "formatOnSave"
    @readConfig "defaultTableJustification"
    @readConfig "markdownGrammarScopes"
    @readConfig "limitLastColumnPadding"
    @readConfig 'preferredLineLength', 'editor'

  destroy: ->
    @subscriptions.dispose()
