Version 3.1.4
This commit is contained in:
1 parent
1d4720f3e2
commit
ae5c01cc78
2563 files changed
+283048
-240689
No files matched your search
@@ -18,9 +18,9 @@
|
||||
* Geoffrey T. Dairiki <dairiki@dairiki.org>. The original PHP version of this
|
||||
* code was written by him, and is used/adapted with his permission.
|
||||
*
|
||||
* $Horde: framework/Text_Diff/Diff/Engine/native.php,v 1.7.2.4 2008/01/04 10:38:10 jan Exp $
|
||||
* $Horde: framework/Text_Diff/Diff/Engine/native.php,v 1.7.2.5 2009/01/06 15:23:41 jan Exp $
|
||||
*
|
||||
* Copyright 2004-2008 The Horde Project (http://www.horde.org/)
|
||||
* Copyright 2004-2009 The Horde Project (http://www.horde.org/)
|
||||
*
|
||||
* See the enclosed file COPYING for license information (LGPL). If you did
|
||||
* not receive this file, see http://opensource.org/licenses/lgpl-license.php.
|
||||
@@ -32,9 +32,22 @@ class Text_Diff_Engine_native {
|
||||
|
||||
function diff($from_lines, $to_lines)
|
||||
{
|
||||
array_walk($from_lines, array('Text_Diff', 'trimNewlines'));
|
||||
array_walk($to_lines, array('Text_Diff', 'trimNewlines'));
|
||||
|
||||
$_f = array();
|
||||
$_t = array();
|
||||
|
||||
foreach( $from_lines as $l )
|
||||
{
|
||||
$_f[] = str_replace(array("\n", "\r"), '', $l);
|
||||
}
|
||||
|
||||
foreach( $to_lines as $l )
|
||||
{
|
||||
$_t[] = str_replace(array("\n", "\r"), '', $l);
|
||||
}
|
||||
|
||||
$from_lines = $_f;
|
||||
$to_lines = $_t;
|
||||
|
||||
$n_from = count($from_lines);
|
||||
$n_to = count($to_lines);
|
||||
|
||||
@@ -106,7 +119,7 @@ class Text_Diff_Engine_native {
|
||||
++$yi;
|
||||
}
|
||||
if ($copy) {
|
||||
$edits[] = new Text_Diff_Op_copy($copy);
|
||||
$edits[] = &new Text_Diff_Op_copy($copy);
|
||||
}
|
||||
|
||||
// Find deletes & adds.
|
||||
@@ -121,11 +134,11 @@ class Text_Diff_Engine_native {
|
||||
}
|
||||
|
||||
if ($delete && $add) {
|
||||
$edits[] = new Text_Diff_Op_change($delete, $add);
|
||||
$edits[] = &new Text_Diff_Op_change($delete, $add);
|
||||
} elseif ($delete) {
|
||||
$edits[] = new Text_Diff_Op_delete($delete);
|
||||
$edits[] = &new Text_Diff_Op_delete($delete);
|
||||
} elseif ($add) {
|
||||
$edits[] = new Text_Diff_Op_add($add);
|
||||
$edits[] = &new Text_Diff_Op_add($add);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user