Skip to content

Commit

Permalink
Merge branch 'master' of git://github.com/petrkalivoda/horde into pet…
Browse files Browse the repository at this point in the history
…rkalivoda-master
  • Loading branch information
yunosh committed Jun 11, 2014
2 parents 7a571b8 + 7e8e90a commit 82a4cf3
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 2 deletions.
4 changes: 2 additions & 2 deletions framework/Text_Diff/lib/Horde/Text/Diff/Renderer/Inline.php
Expand Up @@ -146,8 +146,8 @@ protected function _changed($orig, $final)

if ($this->_split_characters) {
$diff = new Horde_Text_Diff('native',
array(preg_split('//u', $text1),
preg_split('//u', $text2)));
array(preg_split('//u', str_replace("\n", $nl, $text1)),
preg_split('//u', str_replace("\n", $nl, $text2))));
} else {
/* We want to split on word boundaries, but we need to preserve
* whitespace as well. Therefore we split on words, but include
Expand Down
22 changes: 22 additions & 0 deletions framework/Text_Diff/test/Horde/Text/Diff/RendererTest.php
Expand Up @@ -287,4 +287,26 @@ class="anchor" title="Link to this section"><br />
$renderer = new Horde_Text_Diff_Renderer_Inline();
$renderer->render($diff);
}

public function testGithubPullRequest86()
{
$a = <<<EOA
One
Two
EOA;

$b = <<<EOB
Ones
Twos
EOB;
$patch = <<<EOPATCH
One<ins>s</ins>
Two<ins>s</ins>
EOPATCH;

$diff = new Horde_Text_Diff('Native', array(explode("\n", $a), explode("\n", $b)));
$renderer = new Horde_Text_Diff_Renderer_Inline(array('split_characters' => true));
$this->assertEquals($patch, $renderer->render($diff));
}
}

0 comments on commit 82a4cf3

Please sign in to comment.