multihack / multihack-brackets

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

Show remote carets #22

Closed Worie closed 7 years ago

Worie commented 7 years ago

Hi, when you get into one room with other people, the code is synced but you cannot see their caret/carets and dont really know what are they doing. I think it is worth reconsideration :)

You could also add them specific color / or show the nickname nearby them (enabled on hover or anytime, didn't want create a separate issue for that as it is pretty much related to carets)

t-mullen commented 7 years ago

Yup, this is a good idea. Everything is set up to allow this, but I haven't been able to find a way to display remotes carets. There's no Codemirror API for it, unlike selections.

Will probably need some kind of overlay, so it will happen eventually.

Worie commented 7 years ago

Right, there is none for carets themselves. I guess we could probably fake them with cm.addWidget and position them on specific {line, ch}, basing on remote starting position of selection. This is just a visualization so it shouldn't be too troublesome.

I'll try to understand your solutions on this repo and create a PR if I manage to find some time, but again your solutions to problems which I've met too are much more elegant, so I guess that'd take me a while.

t-mullen commented 7 years ago

I agree that's probably the best way to do it. PRs always welcome!

Worie commented 7 years ago

Started working on this feature :)

Worie commented 7 years ago

After recents changes the feature seems to glitch a bit, see: here. If you type in the editor, the remote caret seems to be left one character behind. Also there is a weird freezed caret in the editor of the first peer who connected.

I haven't looked into it too deeply, but it seems you removed the changes listener in the editor.js?

And I guess we should create a separate issue related to this , i mean to be able to tell the difference between the carets (which is whose) etc

t-mullen commented 7 years ago

Yeah, I noticed this too. Change are being applied after the caret moves. It's fixed now. (4.0.1)

I removed the "changes" listeners since it turns out caret changes are emitted as zero-length selection changes in Codemirror. It was less code.