multihack / multihack-brackets

Realtime collaboration for programmers. (Brackets Extension)
MIT License
24 stars 9 forks source link

Show remote carets #23

Closed Worie closed 7 years ago

Worie commented 7 years ago

Here we go. I tried to follow your codestyle, I guess it should be ok. The changes provided should cover every input from peers (multiple carets, removals, additions, pastes and cuts)

If this PR's alright, then in the future I guess we should create a html template for carets (for future features such as displaying the carets owner name and for code maintenance purposes)

This solves #22

Worie commented 7 years ago

Just realized that it works well when there are only two peers, but fails with more than that.

The problem is that upon recieving the change event, the remoteCarets set is being cleared.

So in scenario:

  1. Peer A connects
  2. Peer B connects
  3. Peer C connects
  4. Peer B moves his caret
  5. Peer A and C sees it
  6. Peer C moves his caret.
  7. Peer A loses the state of peer B caret.

So, each peer should have probably his own Set().

t-mullen commented 7 years ago

Looks good, thanks for figuring this out. I added a few comments.

Worie commented 7 years ago

Guess that's it. Besides the requested changes I've left a comment about the issue I mentioned in https://github.com/RationalCoding/multihack-brackets/pull/23#issuecomment-298181615 earlier.

t-mullen commented 7 years ago

OK, seems to be working great aside from the issue with >2 users. I'll fix that in a later commit when I do cursor colours. Thanks @Worie !

Would you like to be added as a maintainer? I can always use some more help developing this :)

Worie commented 7 years ago

I'm glad it's ok :) When it comes to me as a maintainer - I can't really promise anything as I don't know how much spare time will I have, but sure - that'd be nice, thanks!