 
   destroy: ->
     @off 'focus', @focus
-    $(window).off 'resize', @resizeToPane
+    $(window).off 'resize', @resizeToPane_
     if @ptyProcess
       @ptyProcess.terminate()
       @ptyProcess = null

    @input atom.clipboard.read()

  focus: ->
    @resizeToPane()
    @focusTerm()

  focusTerm: ->
    @term.focus()

  resizeToPane: ->
    {cols, rows} = @getDimensions_()
    @resize cols, rows


    ) + "px"

  attachEvents: ->
    @resizeToPane_ = @resizeToPane_.bind this
    @on 'focus', @focus
    $(window).on 'resize', => @resizeToPane_()
    @disposable = atom.workspace.getActivePane().observeFlexScale => setTimeout (=> @resizeToPane_()), 300
    atom.commands.add "atom-workspace", "term2:paste", => @paste()
    atom.commands.add "atom-workspace", "term2:copy", => @copy()

