       )
     )
     @doc.forceTrailingNewline()
+    _.each(cursors, (index, userId) =>
+      this.moveCursor(userId, index)
+    )
     newDelta = @doc.toDelta()
     composed = JetSync.compose(oldDelta, delta)
     composed.compact()

    offset = 0      # Tracks how many characters inserted to correctly offset new text
    oldDelta = @doc.toDelta()
    retains = []
    _.each(delta.deltas, (delta) =>
      if JetDelta.isInsert(delta)
        @doc.insertText(index + offset, delta.text)
        retains.push(new JetRetain(index + offset, index + offset + delta.text.length, delta.attributes))
        offset += delta.getLength()
      else if JetDelta.isRetain(delta)

    inner.style['background-color'] = nameNode.style['background-color'] = color
    cursor.appendChild(nameNode)
    cursor.appendChild(inner)
    @cursors[userId] = {
      index: index
      name: name
      color: color
    }
    Tandem.Utils.insertExternal(new Tandem.Position(this, index), cursor)
    line = @doc.findLine(cursor)
    line.rebuild() if line?

  moveCursor: (userId, index) ->
    if @cursors[userId]
      this.setCursor(userId, index, @cursors[userId].name, @cursors[userId].color)

  clearCursors: ->
    _.each(@doc.root.querySelectorAll('.cursor'), (cursor) ->
