GithubHelp home page GithubHelp logo

ahtik / google-diff-match-patch Goto Github PK

View Code? Open in Web Editor NEW
0.0 0.0 0.0 2.34 MB

Automatically exported from code.google.com/p/google-diff-match-patch

License: Apache License 2.0

C++ 12.04% QMake 0.03% C# 11.62% Dart 10.38% HTML 1.40% Java 11.17% JavaScript 9.32% Lua 9.17% Objective-C 15.38% C 1.73% Python 17.75%

google-diff-match-patch's Introduction

google-diff-match-patch's People

Contributors

neilfraser avatar

Watchers

 avatar

google-diff-match-patch's Issues

Feature Request for ColdFusion Implementation

It would be really awesome if there was a a ColdFusion implementation of this, 
or a "how to use with ColdFusion". I know adding jar files to ColdFusion server 
is very easy, but I'm not sure what would be required to integrate the utility 
and use it with a UDF...

Anyone aware of any CF implementations out there?

Original issue reported on code.google.com by [email protected] on 4 Jan 2011 at 3:51

can't get index, via java API: diff_main(String text1, String text2)

What steps will reproduce the problem?
1. use java API: diff_main(String text1, String text2).
    text1 = "this is a test";
    text2 = "this is a test A";   
2. LinkedList<Diff> diff = diff_main(String text1, String text2);
3. in "LinkedList<Diff> diff", I can't get "index" of in Diff Class.

What is the expected output? What do you see instead?
expected output: index = 16
but index always equal -1

What version of the product are you using? On what operating system?
version:20071106, java 
OS: windows XP

Please provide any additional information below.


Original issue reported on code.google.com by [email protected] on 29 Dec 2007 at 2:55

Copyright year is 2006

What steps will reproduce the problem?
1. Look at the source code

What is the expected output? What do you see instead?
Given the datestamp in the filename, I would assume that the copyright
notice would be dated 2008 instead of 2006.
Note that the JavaScript file hasn't got any copyright notice at all.

What version of the product are you using? On what operating system?
diff_match_patch_20080426.zip

Please provide any additional information below.
This is obviously a purely cosmetic issue.

Original issue reported on code.google.com by [email protected] on 29 Apr 2008 at 7:56

"Word Mode" - The definition of a 'word'

---What steps will reproduce the problem?
1. Try implementing the "Word Mode" explained here 
http://code.google.com/p/google-diff-match-patch/wiki/LineOrWordDiffs
2. Diff some stuff
3. Eat pizza

---What is the expected output? What do you see instead?
We should have the choice of determining what is a "word". Does it include the 
delimiter (whitespace) before it? Does it include the delimiter following it? 
Is the delimiter itself considered a separate 'word' in its own right?
Instead, the decision seems to have been hardcoded that the word-delimiter 
(whitespace in my case) is part of the previous word.


---What version of the product are you using? On what operating system?
JavaScript version
Windows XP
Testing with IE8 and Chrome


---Please provide any additional information below.
I need every word-delimiter (whitespace in my case) to be considered a separate 
'word' in its own right. Any quick fixes to do this please?

Original issue reported on code.google.com by [email protected] on 19 May 2011 at 4:33

The diffing algorithm is not accurate

While it *does* report differences, it tends to pick the largest diff that
it can (rather than more, smaller, diffs).  

Choose a large (10MB or so) text file with lots of carriage returns -- an
XML file formatted for readability will do -- and permute it with the
following algorithm (this is Ruby code; $. is the current line in the
input, and gsub! alters the current string):

  for x in STDIN
    if $. % 1000 == 0
      deleted = x 
    elsif $. % 100 == 0          
      puts deleted if deleted
    elsif $. % 10 == 0             
      x.gsub!(/>.*</, ">XY<")
      puts x
    else
      puts x
    end
  end                              

This deletes every 1000'th line, inserts the previously deleted line every
100'th line, and alters every 10'th line.   

diff_match_patch reported the following changes:

  Operation     String size
  EQUAL         339
  DELETE        13934676
  INSERT        13860601
  EQUAL         92

So, basically, it reported that the whole file had changed.  The same two
files run through GNU diff resulted in 36766 differences.  A corresponding
patch made from diff_match_patch would have resulted in a patch file almost
as big as the original file (nearly 14MB); the patch file from GNU diff was
around 3MB, or 1/4 the size. This means that that the algorithm used by
diff_match_patch produces extremely inefficient patches.

Incidentally, setting the "checklines" flag to false actually results in a
*faster*, not slower, diff, although the resulting reported differences
don't vary greatly.

This is with 20090501 with Java 1.6.0 on Ubuntu Intrepid.

Original issue reported on code.google.com by seanerussell on 7 Jun 2009 at 12:21

  • Merged into: #26

Add the CHANGED operation

Hello,
as I could see the library is very good.

I need one more functionality in diff, the CHANGED lines.



Original issue reported on code.google.com by [email protected] on 21 Oct 2008 at 10:27

QT Library?

Why is it required to have the QT Library for C++? That's a big chunk of
code just to use QList and QString (Maybe there is more I'm not seeing).

Why not use the C++ Standard Library?

Original issue reported on code.google.com by bradleelandis on 8 Sep 2009 at 8:42

where is Diff class for java?

What steps will reproduce the problem?
1. download diff_match_patch.java
2. compile it

What is the expected output? What do you see instead?
expected: compiled
I see: no Diff class



Original issue reported on code.google.com by [email protected] on 13 Jun 2007 at 3:34

Bad space/time complexity on non-trivial files

What steps will reproduce the problem?
1. Download the attached sample files (two whitespace-simplified versions
of a generated source file in the Hadoop project).
2. Use the library to compute the diff. The diff timeout would have to be
increased significantly or set to 0.0f.

What is the expected output? What do you see instead?
GNU diff computes a diff with about 1260 edit steps in 0.125s on my
machine. diff-match-patch with the diff timeout removed fails to terminate
in both its C++ and Java versions, consuming all available system memory.

What version of the product are you using? On what operating system?
Latest svn trunk on GNU/Linux amd64.

Please provide any additional information below.
The attached files are just an extreme example; I have also found it
infeasible to compute a diff between two files of about 2000 lines each in
Java with a 2G heap. The timeout prevents all memory from being used, but
results in a trivial "delete A, insert B" diff, which is not useful.

Original issue reported on code.google.com by [email protected] on 20 Jan 2010 at 12:03

Attachments:

Python diff-match-patch isn't listed on PyPI

It would be extremely handy if users could use "pip install diff-match-patch" 
or "easy_install diff-match-patch" to install install the Python library from 
http://pypi.python.org/

Original issue reported on code.google.com by [email protected] on 13 Apr 2011 at 1:48

Would you consider creating a C# version?

 Awesome piece of implementation.

I would love to create the C# version myself but being ignorant about the
algorithms I could make silly mistakes.

Would you consider creating a C# version?

Original issue reported on code.google.com by [email protected] on 6 Feb 2008 at 4:49

Feature request: Google Code style output

Would be nice to have a method that print a diff like Google Code does:
http://code.google.com/p/google-diff-match-patch/source/diff?spec=svn85&r=85&for
mat=side&path=/trunk/javascript/diff_match_patch_uncompressed.js#sc_svn83_240

The changed lines are highlighted. The diff_prettyHtml method doesn't do that.

Original issue reported on code.google.com by [email protected] on 11 Feb 2011 at 1:45

Consider providing a Cython implementation

By just copying and pasting the pure Python version of diff-match-patch to a 
pyx file and compiling it with Cython, the time it takes to compare the 
speedtest text files with the provided unit test, was cut in half.



Original issue reported on code.google.com by [email protected] on 19 Jan 2011 at 10:40

Wrong assert class used in C# language

What steps will reproduce the problem?
1. Create a solution including projects in C# language
2. Reference the nUnit framework and Microsoft Test Framework in a test project
3. Run TestMethod named: 'diff_bisectTest'

What is the expected output? What do you see instead?
Excpected output is a 'success'


What version of the product are you using? On what operating system?
I'm using VS 2008 running on a Windows 7 32bit. The code for google diff was 
downloaded from: 'diff_match_patch_20110217.zip'

Please provide any additional information below.
The problem is simple and was solved changing one line of code that occours 
twice on the same test method named 'diff_bisectTest':
from: Assert.AreEqual(diffs, dmp.diff_bisect(a, b, DateTime.MaxValue));
to: CollectionAssert.AreEqual(diffs, dmp.diff_bisect(a, b, DateTime.MaxValue));

Original issue reported on code.google.com by [email protected] on 4 Apr 2011 at 5:56

Important: Ping me if you file a bug.

Google Code does not currently send any notification to me when a new issue
is added to this list.  Since there are virtually no issues with my code
(gloat), I don't visit this page often.

So if you don't want to be ignored, send me an email to let me know that
you've filed a new bug:
  http://neil.fraser.name

Thanks!

Original issue reported on code.google.com by [email protected] on 29 Jun 2007 at 1:32

java code bug

when i compare the following two text on sit   
"ZHEJIANG JIANGLONG TEXTILE PRINTING" and   
"ZHEJIANG JIANGLIMEI KNITTING CLOTH"
with Match balance=0.6 and Match threshold: 0.4 
i have two results: 
The first when using Demo of Match on the site(JavaScript)the result is
don't match 
the second result when using java code in my application the result is
match ok (found)
what is the difference?



Original issue reported on code.google.com by [email protected] on 9 Sep 2008 at 12:12

Python implementation cannot be imported as a module

Please provide any additional information below.

First of all, thank you for your great work on this library.

I would like to be able to import the Python implementation as a module so
that I can keep a checkout of the python folder in our common directory
(which is on every system's Python path). If it functioned as a module,
then I wouldn't have to modify all Python paths and treat diff_match_patch
as an edge-case (it could just be checked out directly in the common, or
any folder on the path, and it will Just Work). This will also work for
anyone else who has a common directory already on their path and wants to
use diff_match_patch without modification of their path or creation of
symlinks.

Fix:

Create __init__.py in the python directory, with this inside:

from .diff_match_patch import diff_match_patch, patch_obj

As I understand it (via http://www.python.org/dev/peps/pep-0328/), this
relative import syntax should be compatible with 2.4 or greater. Thanks!

Original issue reported on code.google.com by [email protected] on 28 Aug 2009 at 4:29

JavaScript: allow easy way to remove diff/match/patch sections

In browser-side JavaScript, file size matters a lot. It would be nice if there 
was a well-documented easy way to get rid of the code that wasn't needed for 
Match and Patch if all you care about is the Diff features, for instance.

Original issue reported on code.google.com by philfreo on 4 May 2011 at 10:01

r70 has broken diff_match_patch_test.cpp

I just downloaded the new diff_match_patch_20101028.zip.

I don't think this line (from r70) in diff_match_patch_test.cpp is correct:

896 +     QString resultStr =  + "\t" + sprintf(str, "%s\t%d", results.first, 
boolArray.count());


Original issue reported on code.google.com by [email protected] on 29 Oct 2010 at 1:34

System.OutOfMemoryException with two dissimilar files - one very large

I'm using the C# version of the code. I get a 'System.OutOfMemoryException'  
with the two attached files. Note that these files are not similar at all, 
apart from being XML files, and the one is very large. The exception occurs in:

   protected List<Diff> diff_map(string text1, string text2)

This is the code I use to call it:

var dmp = new DiffMatchPatch.diff_match_patch();
dmp.Diff_Timeout = 0;
dmp.Diff_EditCost = 4;
dmp.Match_Threshold = 0.5F;
var diffs = dmp.diff_main(text1, text2, true);


Original issue reported on code.google.com by [email protected] on 9 Aug 2010 at 11:11

  • Merged into: #26

Attachments:

Java warning in diff_compute

Problem:
Unchecked cast from Object to ArrayList<String> in diff_match_patch.java on
line 229 in function diff_compute.

What is the expected output? What do you see instead?
No warnings should be produced

What version of the product are you using?
diff_match_patch_20090615.zip

Solution:
Create a new class diff_linesToChars_result with public the following
signature:

public String chars1;
public String chars2;
public List<String> lineArray;

See attachement

Original issue reported on code.google.com by [email protected] on 17 Jul 2009 at 7:12

Attachments:

java ArrayIndexOutOfBoundsException: 2 on diff_main

I'm getting an issue by calling the function diff_main, with the text in the 
file first_arg in first arg and the text in the file second_arg in second arg, 
it displays me the stack trace :

java.lang.ArrayIndexOutOfBoundsException: 2
        diff_match_patch.diff_bisect(diff_match_patch.java:374)
        diff_match_patch.diff_compute(diff_match_patch.java:296)
        diff_match_patch.diff_main(diff_match_patch.java:198)
        diff_match_patch.diff_compute(diff_match_patch.java:274)
        diff_match_patch.diff_main(diff_match_patch.java:198)
        diff_match_patch.diff_main(diff_match_patch.java:153)
        diff_match_patch.diff_main(diff_match_patch.java:132)

Thanks in advance

Francis

Original issue reported on code.google.com by [email protected] on 21 Jan 2011 at 9:25

Attachments:

Doesn't work with node.js

What steps will reproduce the problem?
1. create a node app
2. var diff = require("./lib/diff_match_patch.js");
3. run the app

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

The app should run. Instead I get "ReferenceError: window is not defined". 
Looks like this lib is assuming a browser environment.


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

Looks like diff_match_patch_20110603. OS X 10.6.8.


Please provide any additional information below.


Original issue reported on code.google.com by *[email protected] on 12 Jul 2011 at 6:58

diff_cleanupSemantic doesn't always cleanup

Usually diff_cleanupSemantic does an excellent job :-).
However, in this case it appears to have a problem.

What steps will reproduce the problem?
In JavaScript (with default settings):
var a='\tS += "</table><pre style=\'display:none\'>";\n'+
  '\tS += text.replace(/>/g, \'&gt;\');\n'+
  '\tS += "</pre></li></ul></div>\\n";';
var b='\n'+'\tt = lines.join(\'\\n\').replace(/>/g, \'&gt;\');\n'+
  '\tS += "</table><pre style=\'display:none\'>".concat(t, "</pre></li></ul></div>\\n");';
var DMP = new diff_match_patch;
var d=DMP.diff_main(a,b);
DMP.diff_cleanupSemantic(d);
for (var i in d) print('{',d[i][0],', "',d[i][1],'"}');

The output is as follows (which is basically the same as with no cleanup):
{ -1 , "    S "}
{ 1 , " 
    t "}
{ 0 , "   "}
{ -1 , " + "}
{ 0 , " =  "}
{ -1 , " "</tab "}
{ 0 , " l "}
{ 1 , " in "}
{ 0 , " e "}
{ -1 , " ><pre  "}
{ 0 , " s "}
{ -1 , " tyle='d "}
{ 1 , " .jo "}
{ 0 , " i "}
{ -1 , " splay: "}
{ 0 , " n "}
{ -1 , " o "}
{ 1 , " ('\ "}
{ 0 , " n "}
{ -1 , " e "}
{ 0 , " ' "}
{ -1 , " >";
    S += text "}
{ 1 , " ) "}
{ 0 , " .replace(/>/g, '&gt;');
    S +=  "}
{ 1 , " "</table><pre style='display:none'>".concat(t,  "}
{ 0 , " "</pre></li></ul></div>\n" "}
{ 1 , " ) "}
{ 0 , " ; "}

What version of the product are you using? On what operating system?
diff_match_patch_20080520.zip on Mac OS X 10.4.7

Please provide any additional information below.
Deleting the '\n' at the beginning of var b reduces the diff from 31 to 9 
elements. As follows:
{ 0 , "      "}
{ -1 , " S += "</table><pre style='display:none'>";
    S += text.replace(/>/g, '&gt;');
    S += "}
{ 1 , " t = lines.join('\n').replace(/>/g, '&gt;');
    S += "</table><pre style='display:none'>".concat(t, "}
{ 0 , "  "</pre></li></ul></div>\n" "}
{ 1 , " ) "}
{ 0 , " ; "}

Original issue reported on code.google.com by [email protected] on 25 May 2008 at 12:42

C++ header doesn't include require QT types

The C++ header file "diff_match_patch.h" doesn't include the QT types it uses, 
which force users of this header to include then in the each file that include 
the header.

IMO will be better to put the required QT includes in "diff_match_patch.h"

The required includes are

#include <QString>
#include <QList>
#include <QMap>
#include <QVariant>

Original issue reported on code.google.com by [email protected] on 23 Dec 2010 at 9:34

Pattern too long for this browser

What steps will reproduce the problem?

 I attached a JS file which reproduces the problem.

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

 Error: Pattern too long for this browser. 

What version of the product are you using? On what operating system?
 javascript running on Rhino, java 1.5

Please provide any additional information below.
 the patch causing that problem is created by patch_fromText() and a
subsequent reverting of the patch (changing DELETES into INSERTS - that's
why the first status field says "-0").

Original issue reported on code.google.com by [email protected] on 7 Sep 2009 at 11:26

Attachments:

Unchecked cast (Java)

Compiling project generates a warning for line 221:
 linearray = (ArrayList<String>) b[2];
results in:
 Type safety: Unchecked cast from Object to ArrayList<String>

This can be worked around by ignoring warnings of course, so I'm not clear
on whether this is important or not (a relative noob at Java). My apologies
if this is normal behaviour.

What version of the product are you using? On what operating system?
Version 20080624
Built in Eclipse with java 1.6.0.10 on Ubuntu 8.10

Original issue reported on code.google.com by [email protected] on 8 Nov 2008 at 6:23

dummy bug test for neil

What steps will reproduce the problem?
1.
2.
3.

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


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


Please provide any additional information below.


Original issue reported on code.google.com by [email protected] on 28 Jun 2007 at 11:53

Pattern too long for this browser

What steps will reproduce the problem?
     var dmp = new diff_match_patch();
     var last = 'abcdefghij , h : 1 , t : 1 abcdefghij , h : 1 , t :
1 abcdefghij , h : 0 , t : 1';
     var current = 'abcdefghij , h : 0 , t : 1 abcdefghij , h : 0
, t : 1 abcdefghij , h : 0 , t : 1';
     var patches = dmp.patch_make(current, last);
     var mod_current = 'abcdefghij , h : 0 , t : 1 abcdefghij , h : 1
, t : 1 abcdefghij , h : 0 , t : 1';
     var res = dmp.patch_apply(patches, mod_current);

What is the expected output? What do you see instead?
Expect patch to succeed or fail.  Actually it throws an error "Pattern too
long for this browser".  Only affects JavaScript version (the bug is also
in the Python version but is never expressed).

Fathei Ali reported this error and I tracked it down to an indexing bug in
patch_splitMax.  Most of the time this would have no effect, but very
occasionally it fails to split a long patch.

A new version has been pushed which corrects this bug and unit tests have
been added in all languages for verification.

Original issue reported on code.google.com by [email protected] on 4 Dec 2008 at 5:50

An error in C++ code

There is an error in diff_match_patch.cpp on line 438:

436      if (!front) {
437        int k1 = delta - k2;
438        if (v2.contains(k2)) {
439          int x1 = v1.value(k1);

It should have been the following:

438        if (v1.contains(k1)) {

Original issue reported on code.google.com by [email protected] on 12 Jan 2011 at 1:25

Feature: PHP implementation

The comments on the API page hint that at least a partial PHP conversion is 
available.

It should be committed to the repository with the other code.

Make sure to clearly specify the license for PHP code.

Original issue reported on code.google.com by mikko.rantalainen on 1 Jul 2010 at 7:46

UnicodeDecodeError in Python version when using Cyrillic characters.

Want to use Cyrillic characters with diff_match_patch (python version,
release), but got errors like:
"UnicodeDecodeError: 'utf8' codec can't decode byte 0xd0 in position 0:
unexpected end of data"

appending in some places to strings ".decode("utf-8").encode("utf-8")",
seem to solve the problems, but I guess not 100%.

see the attached patch (and for any case new file).

Alexandr.

Original issue reported on code.google.com by [email protected] on 11 May 2008 at 1:12

Attachments:

compare like knol

What steps will reproduce the problem?
1. use for compare diff in HTML (with tags)

What is the expected output? What do you see instead?
compare like knol


What version of the product are you using? On what operating system?
diff_match_patch_20090202


Please provide any additional information below.
any sugestion???


Original issue reported on code.google.com by [email protected] on 5 Mar 2009 at 5:10

SyntaxWarning in Python2.6 (MacOSX Leopard)

diff_match_patch.py:430: SyntaxWarning: assertion is always true, perhaps 
remove parentheses?
  assert (text1[x] == text2[y],
diff_match_patch.py:475: SyntaxWarning: assertion is always true, perhaps 
remove parentheses?
  assert (text1[-x - 1] == text2[-y - 1],
diff_match_patch.py:1158: SyntaxWarning: assertion is always true, perhaps 
remove parentheses?
  assert (self.Match_MaxBits == 0 or len(pattern) <= self.Match_MaxBits,
 SyntaxWarning: assertion is always true, perhaps remove parentheses?
  assert (False, "Unknown call format to patch_make.")

Original issue reported on code.google.com by [email protected] on 2 May 2009 at 12:54

Is it possible to do word by word comparison?

This is a great piece of code. I have one concern on the compariosn. Is it 
possible to chnage the logic in such a way that it does word by word 
comparison? 

I have written following test code in java
========================================================================
String text1="Hello how are you. <br/> My name is Prathyusha. Shravanthi 
is my friend.";
String text2="Hello. <br/>My name is Shravanthi. Prathyusha was my 
friend.";
diff_match_patch diff = new diff_match_patch(); 
LinkedList<diff_match_patch.Diff> diffs = diff.diff_main(text1, text2);
diff.diff_cleanupSemantic(diffs);
String result = diff.diff_prettyHtml(diffs);
System.out.println(result);
=====================================================================

I see the following output
--------------------------------------------------------
Hello<DEL> how are you</DEL>. <br/><DEL> </DEL>My name is <DEL>Prathyusha. 
Shravanthi i</DEL><INS>Shravanthi. Prathyusha wa</INS>s my friend.
--------------------------------------------------------

As the output shows the logic doesn't break the differences into logical 
words. Rather it does comparison on a chunk of string. Word by word 
comparison would help in getting a precise count of the newly added words 
and the deleted words. Additinally if we check the deleted 
<DEL>Prathyusha. Shravanthi i</DEL> text and the inserted <INS>Shravanthi. 
Prathyusha wa</INS> text, the middle chars ' ' and '.' are common. They 
should not be considered as deleted and inserted. This problem wouldn't 
have arised if we do a word by word comparison. The word count in all is 
increased by 4 conidering ' ' and '.' as 2 words.
Is it possible to do a word by word comparison?

Regards,
Pratap

Original issue reported on code.google.com by [email protected] on 4 Jul 2009 at 1:51

cpp version don't compile with gcc-4.4 linux

pepone@sirius ~/projects/cmsdemo/server $ diff 
/home/pepone/diff_match_patch_20101216/cpp/diff_match_patch.cpp 
diff_match_patch.cpp
22a23
> #include <limits>
70c71
<   qDebug(qPrintable(QString("Diff(") + strOperation(operation) + 
QString(",\"")

---
>   qDebug("%s", qPrintable(QString("Diff(") + strOperation(operation) + 
QString(",\"")


Original issue reported on code.google.com by [email protected] on 23 Dec 2010 at 9:16

Null-safe diff

diff_main accepts two Strings as arguments. When one of them is null, diff_main 
fails with a NullPointerException.

How about making it null-pointer safe, like the apache-commons StringUtils?

Patch is attached

Original issue reported on code.google.com by [email protected] on 10 Jun 2010 at 7:39

Attachments:

Invalid patch created

* What steps will reproduce the problem?

I have attached a demonstration of the issue. This creates a patch between
two strings. It then tries to apply the patch to the first string to get
the second string.

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

When applying the patch, an IllegalArgumentException is thrown. The patch
created has the following invalid header on the second chunk:

@@ --2,32 +9,36 @@


* What version of the product are you using? On what operating system?

Latest version (20090202) on OS/X, Java 6 - but also occurs on Linux.


* Please provide any additional information below.

None.

Original issue reported on code.google.com by [email protected] on 24 Mar 2009 at 6:58

Attachments:

Diff has trouble with this article

On the diff demo I tried comparing edits in an article and it's highlighting 
most of the text, instead of the minor changes.

http://neil.fraser.name/software/diff_match_patch/svn/trunk/demos/demo_diff.html

text for left box: http://dl.dropbox.com/u/4055661/text1.txt
text for right box: http://dl.dropbox.com/u/4055661/text2.txt

Original issue reported on code.google.com by [email protected] on 27 Apr 2011 at 8:03

  • Merged into: #38

Mistake in diff_cleanupMerge algorithm in diff_match_patch.cpp

In diff_match_patch::diff_cleanupMerge the 'if (count_delete != 0 && 
count_insert != 0)' is always true because it is proceeded by 'while 
(count_delete-- > 0)' & 'while (count_insert-- > 0)'.
I think the test was supposed to be before the variables were decremented.

Luckily (or not) this only results in consuming extra cycles.

This same bug appears in the Java version, but not in the C#, JavaScript, Lua 
or Python versions.

Patch for C++ attached.

Original issue reported on code.google.com by [email protected] on 4 Nov 2010 at 1:36

Attachments:

How to change status of an issue?

What steps will reproduce the problem?
1. Submit an issue (like issue #48 - a random totally unbiased example, 
guaranteed)
2. Have someone awesome (like Neil Fraser himself!) answer your issue and mark 
it "Done"
3. Post some additional trouble to your issue thread

What is the expected output? What do you see instead?
Unmarking the issue as "Done" is not possible, causing the issue's additional 
trouble to go unnoticed and effectively leaving unresolved issues marked as 
"Done"...

What version of the product are you using? On what operating system?
Google code, on the internet

Please provide any additional information below.
I like pizza.

Original issue reported on code.google.com by [email protected] on 6 Jun 2011 at 1:29

Please deploy to Maven Central

Sonatype has some good resources.

https://docs.sonatype.org/display/Repository/Sonatype+OSS+Maven+Repository+Usage
+Guide

Being in Central would make it much easier to consume.  With the corporate 
build system I'm using, I can't even reference the SVN-based Maven repo that 
dmp is currently in.

Original issue reported on code.google.com by [email protected] on 7 Feb 2011 at 8:20

Line-by-line mode sub-optimal.

Diff sometimes doesn't find what should be trivial differences.


What steps will reproduce the problem?
1. Use the website to compare the two attached texts 
2. Compare v1text to v2text
3. Compare v2text to v1text

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

The only difference between these two texts is the years.  2009 vs 2010

In one case this is computed correctly.
In the other case, you see one large block of text inserted, and
another large block of text deleted.  (timeout was set to 0)

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

http://neil.fraser.name/software/diff_match_patch/svn/trunk/demo/demo_diff.html

Please provide any additional information below.

Shouldn't the output be symmetric?

Original issue reported on code.google.com by [email protected] on 19 Jan 2011 at 9:57

Attachments:

Python UnicodeDecodeError when using Cyrillic (not ascii?) chars

[code]
# -*- coding: utf-8 -*-

from diff_match_patch import diff_match_patch


dmp = diff_match_patch()

str1 = """Привет!"""
str2 = """Привет and Welcome!"""

patches = dmp.patch_make(str1, str2)
#print dmp.patch_toText(patches)

print dmp.patch_apply(patches, str1)[0]
[\code]

$ python dmp.py
Traceback (most recent call last):
  File "dmp.py", line 14, in <module>
    print dmp.patch_apply(patches, str1)[0]
  File "/data/Coding/Python/diff_match_patch.py", line 1401, in patch_apply
    text = nullPadding + text + nullPadding
UnicodeDecodeError: 'ascii' codec can't decode byte 0xd0 in position 0:
ordinal not in range(128)

Original issue reported on code.google.com by [email protected] on 15 May 2008 at 6:44

Minimizing the number of lines

Consider the left text :

AAA
BBB EEE

and the right text

AAA
BBB DDD
BBB EEE

To the human eye, it's obvious that the middle was added.
However, gdmp (and other character level diff algorithms I tried) see it 
differently, spanning the 
added string ("DDD\nBBB") over two lines.
Of course it makes sense from a computational standpoint, but that should at 
least be cleaned 
up by the cleanup functions, which should try to minimize the number of lines.
What do you think ?



Original issue reported on code.google.com by [email protected] on 20 Jun 2008 at 9:35

Memory leak in new C++ version

I haven't tried the new version yet, but this looks, to me, like it leaks:

380:  int *v1 = new int[v_length];
381:  int *v2 = new int[v_length];

<http://code.google.com/p/google-diff-match-patch/source/browse/trunk/cpp/diff_m
atch_patch.cpp?spec=svn85&r=85#380>

I don't see any `delete [] v1;` or `delete [] v2;`.
After all this is only C++ ... no garbage collectors here ;-).

Original issue reported on code.google.com by [email protected] on 22 Jan 2011 at 8:50

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.