Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Delta diff() method returning wrong value.. #45

Closed
naveenrsaradhya opened this issue Oct 19, 2019 · 3 comments
Closed

Delta diff() method returning wrong value.. #45

naveenrsaradhya opened this issue Oct 19, 2019 · 3 comments

Comments

@naveenrsaradhya
Copy link

Old Text : I am Naveen
New Text : I am visakh
I am soumya

I tried find difference between above two versions ...

Old Delta : "{"ops":[{"insert":"I am Naveen\n"}]}"
New Delta : "{"ops":[{"insert":"I am visakh\nI am soumya\n"}]}"

Diff it is giving as : "{"ops":[{"retain":5},{"insert":"vis"},{"delete":1},{"retain":1},{"insert":"kh\nI am soumya"},{"delete":4}]}"

Here after "vis" insertion it is giving as deleted 1 which is wrong.
It should give as visakh inserted then delete right ??
Do am wrong??

@jhchen
Copy link
Member

jhchen commented Oct 19, 2019

It's doing a character level diff not word level and the output is correct.

@jhchen jhchen closed this as completed Oct 19, 2019
@naveenrsaradhya
Copy link
Author

Ok even character also there character no match..
up to I am is correct after Naveen and visakh if compare character level still wrong answer right?

@jhchen
Copy link
Member

jhchen commented Oct 25, 2019

I've checked again and the output is correct. I don't know where the misunderstanding is but suggest you re-review the documentation and play around with different simpler inputs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants