   ###
   confirmed: (match) ->
     @editor.getSelection().clear()
-
     @cancel()
+
     return unless match
+
+    @lastConfirmedWord = match.word
     @replaceTextWithMatch match
     position = @editor.getCursorBufferPosition()
     @editor.setCursorBufferPosition([position.row, position.column])


    selection = @editor.getSelection()
    prefix = @prefixOfSelection selection

    # No prefix? Don't autocomplete!
    return unless prefix.length

  originalCursorPosition: null
  aboveCursor: false
  debug: false
  lastConfirmedWord: null

  initialize: (@editorView) ->
    super
