     @pairingChannel.bind 'client-broadcast-initial-marker', (data) =>
       @receiveFriendInfo(data)
 
+    @pairingChannel.bind 'client-cursor-moved', (data) =>
+      @clearMarkers(data.colour)
+      console.log 'receiving cursor event'
+      console.log data
+
+      if data.selection then @markRows(data.rows, data.colour, false) else @addMarker(data.line, data.colour)
+
     @pairingChannel.bind 'client-grammar-sync', (syntax) =>
       grammar = atom.grammars.grammarForScopeName(syntax)
       @editor.setGrammar(grammar)

    @pairingChannel.trigger 'client-grammar-sync', grammar.scopeName

  syncMarker: ->
    target = $('atom-text-editor#pusht::shadow .line-numbers')[0]
    observer = new MutationObserver (mutations) =>
      newLineNumber = @editor.getCursorBufferPosition().toArray()[0]
      @clearMyMarkers()
      @addMarker(newLineNumber, @markerColour)

    config = {attributes: true, childList: true, characterData: true}

    observer.observe target, config

    @editor.onDidChangeCursorPosition (event) =>
      if event.newBufferPosition.toArray()[0] isnt event.oldBufferPosition.toArray()[0]
        newLineNumber = event.newBufferPosition.toArray()[0]
        @clearMyMarkers()
        @addMarker(newLineNumber, @markerColour)

    @editor.onDidChangeSelectionRange (event) =>
      rows = event.newBufferRange.getRows()
      @clearMyMarkers()
      _.each rows, (row) =>
        @addMarker(row, @markerColour)

  clearMyMarkers: ->
    $("atom-text-editor#pusht::shadow .line-number").each (index, line) =>
      $(line).removeClass(@markerColour)

  addMarker: (line, colour) ->
    $("atom-text-editor#pusht::shadow .line-number-#{line}").addClass(colour)


      takenColour = @colours[keys[3]]
      @assignColour(takenColour)

      @joinPanel.hide()
      @startPairing()
