curran / curran/google-diff-match-patch

JS library gives wrong result.

Open
#110 0 comments 0 reactions 0 assignees View on GitHub
auto-migrated Priority-Medium Type-Defect
Dominant language
Python
Stars
17
Forks
2
PR merge metrics
No merged PRs in 30d

Description

```
What steps will reproduce the problem?

var context = "It's easy as pie to use Mathjax. You just need to study and
remember how to use $$ and $$$. As you can see, it's not that hard. So, let's
try something a bit more complicated.\nHere was a line break with two spaces.
Not that hard, right, grandpa?";
var anchorText = "just need to study and remember how to use $$ and";
var dmp = new diff_match_patch();
dmp.Match_MaxBits = 100;
var offset = dmp.match_main(context, anchorText, 60);
// offset = 69
// meaning: the match starts with "how to use $$ and $$$. As you can see,"

What is the expected output? What do you see instead?

I think offset should be 37, since that'll result in a perfect match. I also
can't figure out a way to change Distance or Threshold parameters to cause that
to happen. The only thing that works is changing the guess parameter ("60") to
be smaller / closer to "37", but I unfortunately don't have that information
for a generic case.

What version of the product are you using? On what operating system?
JavaScript; latest version

Please provide any additional information below.

```

Original issue reported on code.google.com by `alexei.a...@gmail.com` on 19 Jul 2015 at 8:35

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.