   buffer: null
   $ghostText: null
 
+  lastChangeWasPredictionInsert: false
   predictionMarker: null
 
   # The model.


  registerEvents: ->
    console.log 'Registering events...'
    # Updates the prediction model.
    # Invoked 300ms after last buffer change.
    # TODO: use `onDidChange` instead?
    @editor.onDidStopChanging =>

      text = @getTextForCursorContext()


      console.log show_text_for: @predictionList.current()

    @subscribeToCommand @editorView, 'gamboge:complete', =>
      @completeTokens n: 1
    @subscribeToCommand @editorView, 'gamboge:complete-all', =>
      @completeTokens all: yes

    @subscribeToCommand @editorView, 'gamboge:next-prediction', =>
      @predictionList.next()
