     table.join("\n")
 
   createTableRow: (col, {beg, mid, end}) ->
-    tr = new Array(col).fill(mid)
+    tr = new Array(col - 1).fill(mid)
     [tr[0], tr[col]] = [beg, end]
     tr.join("")
 

    atom.workspaceView.append(this)
    @rowEditor.setText("3")
    @columnEditor.setText("3")
    @rowEditor.focus()

  detach: ->
    return unless @hasParent()

    @div class: "markdown-writer markdown-writer-dialog overlay from-top", =>
      @label "Insert Table", class: "icon icon-diff-added"
      @div =>
        @label "Columns", class: "message"
        @subview "columnEditor", new EditorView(mini: true)
        @label "Rows", class: "message"
        @subview "rowEditor", new EditorView(mini: true)

  initialize: ->
    @on "core:confirm", => @onConfirm()
