       d.dispose()
 
   internalChange: (e) ->
+    if @pmutex and @icb.length > 0
+      @internalchanges = @icb.concat(@internalchanges)
+      @icb = []
     for pos in @editor.getCursorBufferPositions()
-      @internalchanges.push {'pos': pos, 'text': text}
+      if @pmutex
+        @internalchanges.push {'pos': pos, 'text': text}
+      else
+        @icb.push {'pos': pos, 'text': text}
 
   externalChange: (e) ->
     lineStartIndex = 0

    @disposables = []
    @internalchanges = []
    @externalchanges = []

    @disposables.push @editor.onDidInsertText (e) => @internalChange e
    @disposables.push @editor.onDidChangeSelectionRange (e) =>

    console.log e.selection.getText()

  process: ->
    @pmutex = false
    #Fix pos of external changes
    rshift = 0
    for ec, i in @externalchanges #Shift
