Thank you for the actually best CRDT implementation for Swift! However, when you do single-character edits to YText, the resulting update messages are wrong.
It's caused by the following part in YStringContent:
func encode(into encoder: YUpdateEncoder, offset: Int) {
if offset == 0 {
encoder.writeString(self.string as String)
} else {
encoder.writeString(self.string.substring(to: offset))
}
}
These offsets work for longer runs, but fail with single characters. You don't need offset == 0 check here, because we can just create a substring from the given offset, even if it's zero.
func encode(into encoder: YUpdateEncoder, offset: Int) {
encoder.writeString(self.string.substring(from: offset))
}
I'm not sure if you are willing to maintain the project in any way, so I didn't submit a pull request yet.
Thank you for the actually best CRDT implementation for Swift! However, when you do single-character edits to YText, the resulting update messages are wrong.
It's caused by the following part in
YStringContent:These offsets work for longer runs, but fail with single characters. You don't need
offset == 0check here, because we can just create a substring from the given offset, even if it's zero.I'm not sure if you are willing to maintain the project in any way, so I didn't submit a pull request yet.