   attachResizeEvents: ->
     @on 'focus', @focus
     $(window).on 'resize', => @resizeToPane()
-    atom.workspace.getActivePane().observeFlexScale => setTimeout (=> @resizeToPane()), 300
-
-  detachResizeEvents: ->
-    @off 'focus', @focus
-    $(window).off 'resize'
+    @disposable = atom.workspace.getActivePane().observeFlexScale => setTimeout (=> @resizeToPane()), 300
 
   focus: ->
     @resizeToPane()

    @fakeRow.remove()
    {cols, rows}

  destroy: ->
    @detachResizeEvents()
    if @ptyProcess
      @ptyProcess.terminate()
    @term.destroy()
    parentPane = atom.workspace.getActivePane()
    if parentPane.activeItem is this
      parentPane.removeItem parentPane.activeItem
    @detach()


module.exports = TermView

      colors, cursorBlink, scrollback, cols, rows
    }

    term.on "data", (data) => @input data
    term.open this.get(0)

