 
   attachEvents: ->
     @resizeToPane = @resizeToPane.bind this
-    @attachResizeEvents()
+    @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()
 

  paste: ->
    @input atom.clipboard.read()

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

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


  onResize: (callback) ->
    @emitter.on 'resize', callback

  input: (data) ->
    try
