     editor.scrollToCursorPosition()
     @is_user_command = true
 
+  getEditor: ->
+    pane = atom.workspace.getActivePane()
+    editor = atom.workspace.getActiveTextEditor()
+    return editor if editor == pane.activeItem
+
   search_next: (word, silent)->
     @_update_statusbar word,true unless silent
     return unless word
-    editor = atom.workspace.getActiveTextEditor()
+    editor = @getEditor()
     return if not editor or editor.mini
     buffer_end = editor.getBuffer().getEndPosition()
     re = @_create_re word

    @is_user_command = true

  kill: ->
    @is_user_command = false
    editor = atom.workspace.getActiveTextEditor()
    editor.transact =>
      editor.selectToEndOfLine()
      texts = (s.getText() or '\n' for s in editor.getSelections())

    @killring.seal()

  kill_region: ->
    editor = @getEditor()
    return unless editor
    @_push_regeon_to_killring editor
    editor.transact ->
      s.delete() for s in editor.getSelections() when not s.isEmpty()

  copy_region: ->
    editor = @getEditor()
    return unless editor
    @_push_regeon_to_killring editor
    cursor.clearSelection() for cursor in editor.getCursors()

  kill_backward_word: ->
    editor = @getEditor()
    return unless editor
    @is_user_command = false
    editor.transact =>
      editor.selectToBeginningOfWord()
      texts = (s.getText() for s in editor.getSelections())
