           @deactivate()
           symbol = result['>>']
           if symbol.length > 0
-            lastInput = content.substr -1
+            lastInput = @input.substr -1
             refill = symbol[0] + lastInput
             # console.log "symbol #{symbol} lastInput #{lastInput} refill #{refill}"
             @agda.editor.getBuffer().setTextInRange range, refill

class InputMethod extends EventEmitter

  activated: false

  @trie: require './keymap.js'


        # console.log "old range: #{@marker.bufferMarker.range.start} #{@marker.bufferMarker.range.end}"
        # console.log "new range: #{range.start} #{range.end}"

        # update input content incrementally,
        # append only with the last character,
        # since the former characters may could have been replaced with a preview symbol
        @input += @agda.editor.getBuffer().getTextInRange(range).substr(1).substr(-1)

        # see if the input is in the keymap
        {valid, result} = @validate()

        
        if valid
          if Object.keys(result).length is 1
            # no further possible key combinations
