PEAR is discontinued

This is a static archive preserving historical releases and metadata. No new packages or updates will be published. For updates to existing packages, or to publish new packages, please use Composer and Packagist.

Home » Text » Text_Diff » Bug #3730

New lines being added in Text_Diff_Renderer_inline

Details

Submitted2005-03-07 13:24 UTC
Fromlphuberdeau at phpquebec dot org
Assignedyunosh
StatusClosed
PackageText_Diff
PHP Version5.0.3
OSWin2K
Roadmaps(Not assigned)

Comments

[2005-03-07 13:24 UTC] lphuberdeau at phpquebec dot org

Description:
------------
When a new line in inserted, new lines are added at strange places.

Reproduce code:
---------------
$test1 = array(
"This is a test.\n",
"Adding random text to simulate files.\n",
"Various Content.\n",
"More Content.\n",
"Testing diff and renderer.\n"
);
$test2 = array(
"This is a test.\n",
"Adding random text to simulate files.\n",
"Inserting a line.\n",
"Various Content.\n",
"Replacing content.\n",
"Testing similarities and renderer.\n",
"Append content.\n"
);

$diff = new Text_Diff( $test1, $test2 );
$renderer = new Text_Diff_Renderer_inline();
$out = $renderer->render($diff);

Expected result:
----------------
This is a test.
Adding random text to simulate files.
<ins>Inserting a line.</ins>
Various Content.
<del> More Content. </del><ins> Replacing content. </ins>
Testing<del> diff </del><ins> similarities </ins> and renderer.
<ins> Append content. </ins>

Actual result:
--------------
This is a test.
Adding random text to simulate files.
<ins>
Inserting a line.
</ins>
Various Content.
<del> More Content. </del><ins> Replacing content. </ins>

Testing<del> diff </del><ins> similarities </ins>
and renderer.<ins>
Append content. </ins>