       saveLocation(type, target)
 
     @subscriptions.add atom.commands.onDidDispatch ({type, target}) =>
+      return if type in ignoreCommands
       return if locationStack.length is 0
-      return if type in ignoreCommands
       return unless shouldSaveLocation(type, target)
       # debug "DidDispatch: #{type}"
       delay 100, =>

      'cursor-history:clear',
    ]
    shouldSaveLocation = (type, target) ->
      if (':' in type) and (editor = target.getModel?()) and editor.getURI?()
        true
      else
        false

    locationStack = []
    saveLocation = _.debounce (type, target) ->


  observeMouse: ->
    locationStack = []
    handleCapture = ({target}) ->
      return unless target.getModel?()?.getURI?()?
      return unless editor = atom.workspace.getActiveTextEditor()
      locationStack.push getLocation('mousedown', editor)

    handleBubble = ({target}) =>
      return unless target.getModel?()?.getURI?()?
      delay 100, =>
        @checkLocationChange(locationStack.pop()) if locationStack.length

    # Mouse handling is not primal purpose of this package
    # I dont' use mouse basically while coding.
    # So keep codebase minimal and simple,
    #  I don't use editor::onDidChangeCursorPosition() to track
    #  cursor position change caused by mouse click.

    # When mouse clicked, cursor position is updated by atom core using setCursorScreenPosition()
