sw-delta icon indicating copy to clipboard operation
sw-delta copied to clipboard

Format needs documentation

Open Daniel15 opened this issue 9 years ago • 3 comments

Hello!

This project is a really interesting idea! I'm trying to write server-side implementations in C# (ASP.NET Core) and PHP, but am having trouble working out the exact format of the delta.

As shown in deltaCalculator.js, going from "this is some test. blah blah blah" to "this is other text. blah blah blah" results in this delta:

§8-1§2-1§1+th§3+r§4-1§1+x

In the 1+th segment, what does the "1" represent? Does it mean that the addition is offset from the previous removal by one character? Is the offset from the start of the previous substring, or the end? It would be good to write a simple spec for other people wanting to implement the same protocol.

Thanks!

Daniel15 avatar Aug 15 '16 08:08 Daniel15

Hi @Daniel15. As the format is probably going to change to binary soon (#7), do not spend too much time writing these implementations now.

I'll answer to the format question when I get a little more time!

gmetais avatar Aug 15 '16 09:08 gmetais

You made me realize that the number of added/removed chars was included in the next offset, which was useless.

Have a look at https://github.com/gmetais/sw-delta-nodejs/pull/1. I believe it's easier to understand now, can you tell me if it still requires a documentation?

gmetais avatar Aug 27 '16 08:08 gmetais

I'll try to take a look soon. I think it's still worth documenting the format for clarity :)

Daniel15 avatar Sep 04 '16 04:09 Daniel15