     @term.focus()
 
   resizeToPane_: ->
-    return unless @ptyProcess
-    {cols, rows} = @getDimensions_()
+    return unless @ptyProcess and @term
+    @term.fit()
+    {cols, rows} = @getDimensions()
     @resize cols, rows
 
   getDimensions: ->
     cols = @term.cols
     rows = @term.rows
-    {cols, rows}
-
-  getDimensions_: ->
-    if not @term
-      cols = Math.floor @width() / 7
-      rows = Math.floor @height() / 15
-      return {cols, rows}
-
-    @find('.terminal').append @fakeRow
-    fakeCol = @fakeRow.children().first()
-    cols = Math.floor (@width() / fakeCol.width()) or 9
-    rows = Math.floor (@height() / fakeCol.height()) or 16
-    @fakeRow.remove()
     {cols, rows}
 
   exit: ->

path = require 'path'
debounce = require 'debounce'
Terminal = require 'xterm'
{CompositeDisposable} = require 'atom'
 # see https://github.com/f/atom-term.js/pull/5
 # see https://github.com/f/atom-term.js/pull/4


  resize: (cols, rows) ->
    return unless @term
    return unless cols > 0 and rows > 0 and isFinite(cols) and isFinite(rows)
    # console.log @term.rows, @term.cols, "->", rows, cols
    try
      if @ptyProcess
        @ptyProcess.send {event: 'resize', rows, cols}
      if @term and not (@term.rows is rows and @term.cols is cols)
        @term.resize cols, rows
    catch error
      console.error error
