     @subscriptions.add atom.workspace.observeTextEditors (editor) =>
       @subscriptions.add editor.onDidChangeCursorPosition @handleCursorMoved.bind(@)
 
-    @subscriptions.add atom.workspace.observeActivePaneItem (item) =>
-      return unless item instanceof TextEditor
+    @subscriptions.add atom.workspace.observeActivePaneItem @handlePaneChanged.bind(@)
 
-      unless @lastEditor
-        @lastEditor = item
-        return
+  dumpLastEditor: ->
+    URI   = @lastEditor.getURI()
+    point = @lastEditor.getCursorBufferPosition()
+    @debug "lastEditor = #{point} #{URI}, "
 
-      @cursorMoveTracking = false
-
-      URI   = @lastEditor.getURI()
-      point = @lastEditor.getCursorBufferPosition()
-
-      args = [@lastEditor, point, URI]
-
-      @debug "# PaneItem Changed: dir = #{@direction}"
-      @debug " From: #{path.basename(URI)} #{point.toString()}"
-      @debug " To:   #{path.basename(item.getURI())} #{item.getCursorBufferPosition()}"
-
-      if @direction
-        if @direction is 'prev' and @history.isNewest()
-          @debug " -- push to head"
-          @history.pushToHead args...
-        @direction = null
-      else
-        @history.add args...
-
-      @lastEditor = item
+  inspectEditor: (editor) ->
+    URI   = @lastEditor.getURI()
+    point = @lastEditor.getCursorBufferPosition()
+    "#{point} #{path.basename(URI)}"
 
   dump: ->
+    @dumpLastEditor()
     @history.dump '', true
 
   toggleDebug: ->

  serialize: ->
    @history?.serialize()

  handleCursorMoved: ({oldBufferPosition, newBufferPosition, cursor}) ->
    unless @cursorMoveTracking
      @debug " -- Tracking Skip in CursorMoved"
      @cursorMoveTracking = true
      return

    editor = cursor.editor
    return if editor.hasMultipleCursors()

    args = [editor, oldBufferPosition, editor.getURI()]
    if @direction
      if @direction is 'prev' and @history.isNewest()
        @history.pushToHead args...

      @direction = null

    else if @needRemember.bind(@)(oldBufferPosition, newBufferPosition, cursor)
      @history.add args...

  needRemember: (oldBufferPosition, newBufferPosition, cursor) ->
    # [FIXME] currently buffer without URI is simply ignored.
    # is there any way to support 'untitled' buffer?
    return false unless cursor.editor.getURI()

    # Line number delata exceeds or not.
    if Math.abs(oldBufferPosition.row - newBufferPosition.row) > @rowDeltaToRemember
      return true
    return false

  next:  -> @jump 'next'
  prev:  -> @jump 'prev'


  activate: (state) ->
    @subscriptions = new CompositeDisposable
    @history = new History atom.config.get('cursor-history.max')

    @rowDeltaToRemember = atom.config.get 'cursor-history.rowDeltaToRemember'
    @subscriptions.add atom.config.onDidChange 'cursor-history.rowDeltaToRemember', ({newValue}) =>
