 
       if @isActive()
         @selectItemForRow(@findRowForNormalItem(0, 'next'))
-      @emitModifiedStatusChanged(false)
+      @setModifiedState(false)
       @emitDidRefresh()
 
   renderItems: (items) ->

                # Delay immediate preview unless @provider is boundToEditor
                @autoPreviewOnNextStopChanging = true
      else
        @emitModifiedStatusChanged(true)

  # HACK: overwrite TextBuffer:isModified to return static state.
  # This state is used for tabs package to show modified icon on tab.
  emitModifiedStatusChanged: (state) ->
    @modifiedState = state
    @editor.buffer.isModified = -> state
    @editor.buffer.emitModifiedStatusChanged(state)

  withIgnoreCursorMove: (fn) ->
    @ignoreCursorMove = true

  items: []
  itemsByProvider: null # Used to cache result
  lastNarrowQuery: ''
  modifiedState: null

  isModified: ->
    @modifiedState

  setModifiedState: (state) ->
    if state isnt @modifiedState
      # HACK: overwrite TextBuffer:isModified to return static state.
      # This state is used for tabs package to show modified icon on tab.
      @modifiedState = state
      @editor.buffer.isModified = -> state
      @editor.buffer.emitModifiedStatusChanged(state)

  onDidMoveToPrompt: (fn) -> @emitter.on('did-move-to-prompt', fn)
  emitDidMoveToPrompt: -> @emitter.emit('did-move-to-prompt')
