 
       triggerPush = false
 
+      cursorPosition = @editor.getCursorBufferPosition().toArray()
+      cursor = @editor.getCursor()
+
       if data.deletion
         buffer.delete oldRange
         @editor.scrollToBufferPosition(oldRange.start)
+        cursor.setBufferPosition(cursorPosition)
       else if oldRange.containsRange(newRange)
         buffer.setTextInRange oldRange, newText
         @editor.scrollToBufferPosition(oldRange.start)
+        cursor.setBufferPosition(cursorPosition)
       else
         buffer.insert newRange.start, newText
         @editor.scrollToBufferPosition(newRange.start)
+        cursor.setBufferPosition(cursorPosition)
 
       triggerPush = true
 

    @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()
