From 7deca91be61f76ac935c147107c82982252a688a Mon Sep 17 00:00:00 2001 From: Robin Getz Date: Wed, 27 Oct 2010 11:46:27 -0400 Subject: White space fixes only - no functional changes --- inc/DifferenceEngine.php | 167 +++++++++++++++++++++-------------------------- 1 file changed, 75 insertions(+), 92 deletions(-) (limited to 'inc/DifferenceEngine.php') diff --git a/inc/DifferenceEngine.php b/inc/DifferenceEngine.php index 7b14e4463..7eae8bd93 100644 --- a/inc/DifferenceEngine.php +++ b/inc/DifferenceEngine.php @@ -30,7 +30,7 @@ class _DiffOp { class _DiffOp_Copy extends _DiffOp { var $type = 'copy'; - function _DiffOp_Copy ($orig, $closing = false) { + function _DiffOp_Copy($orig, $closing = false) { if (!is_array($closing)) $closing = $orig; $this->orig = $orig; @@ -45,7 +45,7 @@ class _DiffOp_Copy extends _DiffOp { class _DiffOp_Delete extends _DiffOp { var $type = 'delete'; - function _DiffOp_Delete ($lines) { + function _DiffOp_Delete($lines) { $this->orig = $lines; $this->closing = false; } @@ -58,7 +58,7 @@ class _DiffOp_Delete extends _DiffOp { class _DiffOp_Add extends _DiffOp { var $type = 'add'; - function _DiffOp_Add ($lines) { + function _DiffOp_Add($lines) { $this->closing = $lines; $this->orig = false; } @@ -71,7 +71,7 @@ class _DiffOp_Add extends _DiffOp { class _DiffOp_Change extends _DiffOp { var $type = 'change'; - function _DiffOp_Change ($orig, $closing) { + function _DiffOp_Change($orig, $closing) { $this->orig = $orig; $this->closing = $closing; } @@ -104,7 +104,7 @@ class _DiffOp_Change extends _DiffOp { */ class _DiffEngine { - function diff ($from_lines, $to_lines) { + function diff($from_lines, $to_lines) { $n_from = count($from_lines); $n_to = count($to_lines); @@ -135,7 +135,7 @@ class _DiffEngine { $xhash[$from_lines[$xi]] = 1; for ($yi = $skip; $yi < $n_to - $endskip; $yi++) { $line = $to_lines[$yi]; - if ( ($this->ychanged[$yi] = empty($xhash[$line])) ) + if (($this->ychanged[$yi] = empty($xhash[$line]))) continue; $yhash[$line] = 1; $this->yv[] = $line; @@ -143,7 +143,7 @@ class _DiffEngine { } for ($xi = $skip; $xi < $n_from - $endskip; $xi++) { $line = $from_lines[$xi]; - if ( ($this->xchanged[$xi] = empty($yhash[$line])) ) + if (($this->xchanged[$xi] = empty($yhash[$line]))) continue; $this->xv[] = $line; $this->xind[] = $xi; @@ -165,8 +165,7 @@ class _DiffEngine { // Skip matching "snake". $copy = array(); - while ( $xi < $n_from && $yi < $n_to - && !$this->xchanged[$xi] && !$this->ychanged[$yi]) { + while ($xi < $n_from && $yi < $n_to && !$this->xchanged[$xi] && !$this->ychanged[$yi]) { $copy[] = $from_lines[$xi++]; ++$yi; } @@ -210,15 +209,14 @@ class _DiffEngine { * match. The caller must trim matching lines from the beginning and end * of the portions it is going to specify. */ - function _diag ($xoff, $xlim, $yoff, $ylim, $nchunks) { + function _diag($xoff, $xlim, $yoff, $ylim, $nchunks) { $flip = false; if ($xlim - $xoff > $ylim - $yoff) { // Things seems faster (I'm not sure I understand why) // when the shortest sequence in X. $flip = true; - list ($xoff, $xlim, $yoff, $ylim) - = array( $yoff, $ylim, $xoff, $xlim); + list ($xoff, $xlim, $yoff, $ylim) = array($yoff, $ylim, $xoff, $xlim); } if ($flip) @@ -284,7 +282,7 @@ class _DiffEngine { return array($this->lcs, $seps); } - function _lcs_pos ($ypos) { + function _lcs_pos($ypos) { $end = $this->lcs; if ($end == 0 || $ypos > $this->seq[$end]) { $this->seq[++$this->lcs] = $ypos; @@ -295,7 +293,7 @@ class _DiffEngine { $beg = 1; while ($beg < $end) { $mid = (int)(($beg + $end) / 2); - if ( $ypos > $this->seq[$mid] ) + if ($ypos > $this->seq[$mid]) $beg = $mid + 1; else $end = $mid; @@ -321,17 +319,15 @@ class _DiffEngine { * Note that XLIM, YLIM are exclusive bounds. * All line numbers are origin-0 and discarded lines are not counted. */ - function _compareseq ($xoff, $xlim, $yoff, $ylim) { + function _compareseq($xoff, $xlim, $yoff, $ylim) { // Slide down the bottom initial diagonal. - while ($xoff < $xlim && $yoff < $ylim - && $this->xv[$xoff] == $this->yv[$yoff]) { + while ($xoff < $xlim && $yoff < $ylim && $this->xv[$xoff] == $this->yv[$yoff]) { ++$xoff; ++$yoff; } // Slide up the top initial diagonal. - while ($xlim > $xoff && $ylim > $yoff - && $this->xv[$xlim - 1] == $this->yv[$ylim - 1]) { + while ($xlim > $xoff && $ylim > $yoff && $this->xv[$xlim - 1] == $this->yv[$ylim - 1]) { --$xlim; --$ylim; } @@ -379,7 +375,7 @@ class _DiffEngine { * * This is extracted verbatim from analyze.c (GNU diffutils-2.7). */ - function _shift_boundaries ($lines, &$changed, $other_changed) { + function _shift_boundaries($lines, &$changed, $other_changed) { $i = 0; $j = 0; @@ -519,7 +515,7 @@ class Diff { * @return object A Diff object representing the inverse of the * original diff. */ - function reverse () { + function reverse() { $rev = $this; $rev->edits = array(); foreach ($this->edits as $edit) { @@ -533,7 +529,7 @@ class Diff { * * @return bool True iff two sequences were identical. */ - function isEmpty () { + function isEmpty() { foreach ($this->edits as $edit) { if ($edit->type != 'copy') return false; @@ -548,7 +544,7 @@ class Diff { * * @return int The length of the LCS. */ - function lcs () { + function lcs() { $lcs = 0; foreach ($this->edits as $edit) { if ($edit->type == 'copy') @@ -598,7 +594,7 @@ class Diff { * * This is here only for debugging purposes. */ - function _check ($from_lines, $to_lines) { + function _check($from_lines, $to_lines) { if (serialize($from_lines) != serialize($this->orig())) trigger_error("Reconstructed original doesn't match", E_USER_ERROR); if (serialize($to_lines) != serialize($this->closing())) @@ -612,7 +608,7 @@ class Diff { $prevtype = 'none'; foreach ($this->edits as $edit) { - if ( $prevtype == $edit->type ) + if ($prevtype == $edit->type) trigger_error("Edit sequence is non-optimal", E_USER_ERROR); $prevtype = $edit->type; } @@ -649,8 +645,7 @@ class MappedDiff extends Diff { * @param $mapped_to_lines array This array should * have the same number of elements as $to_lines. */ - function MappedDiff($from_lines, $to_lines, - $mapped_from_lines, $mapped_to_lines) { + function MappedDiff($from_lines, $to_lines, $mapped_from_lines, $mapped_to_lines) { assert(count($from_lines) == count($mapped_from_lines)); assert(count($to_lines) == count($mapped_to_lines)); @@ -727,9 +722,7 @@ class DiffFormatter { $context = array_slice($edit->orig, 0, $ntrail); $block[] = new _DiffOp_Copy($context); } - $this->_block($x0, $ntrail + $xi - $x0, - $y0, $ntrail + $yi - $y0, - $block); + $this->_block($x0, $ntrail + $xi - $x0, $y0, $ntrail + $yi - $y0, $block); $block = false; } } @@ -754,9 +747,7 @@ class DiffFormatter { } if (is_array($block)) - $this->_block($x0, $xi - $x0, - $y0, $yi - $y0, - $block); + $this->_block($x0, $xi - $x0, $y0, $yi - $y0, $block); return $this->_end_diff(); } @@ -836,14 +827,14 @@ class DiffFormatter { define('NBSP', "\xC2\xA0"); // utf-8 non-breaking space. class _HWLDF_WordAccumulator { - function _HWLDF_WordAccumulator () { + function _HWLDF_WordAccumulator() { $this->_lines = array(); $this->_line = ''; $this->_group = ''; $this->_tag = ''; } - function _flushGroup ($new_tag) { + function _flushGroup($new_tag) { if ($this->_group !== '') { if ($this->_tag == 'mark') $this->_line .= ''.$this->_group.''; @@ -854,14 +845,14 @@ class _HWLDF_WordAccumulator { $this->_tag = $new_tag; } - function _flushLine ($new_tag) { + function _flushLine($new_tag) { $this->_flushGroup($new_tag); if ($this->_line != '') $this->_lines[] = $this->_line; $this->_line = ''; } - function addWords ($words, $tag = '') { + function addWords($words, $tag = '') { if ($tag != $this->_tag) $this->_flushGroup($tag); @@ -887,46 +878,44 @@ class _HWLDF_WordAccumulator { class WordLevelDiff extends MappedDiff { - function WordLevelDiff ($orig_lines, $closing_lines) { + function WordLevelDiff($orig_lines, $closing_lines) { list ($orig_words, $orig_stripped) = $this->_split($orig_lines); list ($closing_words, $closing_stripped) = $this->_split($closing_lines); - $this->MappedDiff($orig_words, $closing_words, - $orig_stripped, $closing_stripped); + $this->MappedDiff($orig_words, $closing_words, $orig_stripped, $closing_stripped); } function _split($lines) { - if (!preg_match_all('/ ( [^\S\n]+ | [0-9_A-Za-z\x80-\xff]+ | . ) (?: (?!< \n) [^\S\n])? /xs', - implode("\n", $lines), - $m)) { + if (!preg_match_all('/ ( [^\S\n]+ | [0-9_A-Za-z\x80-\xff]+ | . ) (?: (?!< \n) [^\S\n])? /xs', + implode("\n", $lines), $m)) { return array(array(''), array('')); - } - return array($m[0], $m[1]); - } + } + return array($m[0], $m[1]); + } - function orig () { - $orig = new _HWLDF_WordAccumulator; + function orig() { + $orig = new _HWLDF_WordAccumulator; - foreach ($this->edits as $edit) { + foreach ($this->edits as $edit) { if ($edit->type == 'copy') - $orig->addWords($edit->orig); + $orig->addWords($edit->orig); elseif ($edit->orig) - $orig->addWords($edit->orig, 'mark'); - } - return $orig->getLines(); - } + $orig->addWords($edit->orig, 'mark'); + } + return $orig->getLines(); + } - function closing () { - $closing = new _HWLDF_WordAccumulator; + function closing() { + $closing = new _HWLDF_WordAccumulator; - foreach ($this->edits as $edit) { - if ($edit->type == 'copy') - $closing->addWords($edit->closing); - elseif ($edit->closing) - $closing->addWords($edit->closing, 'mark'); - } - return $closing->getLines(); - } + foreach ($this->edits as $edit) { + if ($edit->type == 'copy') + $closing->addWords($edit->closing); + elseif ($edit->closing) + $closing->addWords($edit->closing, 'mark'); + } + return $closing->getLines(); + } } /** @@ -986,76 +975,70 @@ class TableDiffFormatter extends DiffFormatter { return $text; } - function _block_header( $xbeg, $xlen, $ybeg, $ylen ) { + function _block_header($xbeg, $xlen, $ybeg, $ylen) { global $lang; $l1 = $lang['line'].' '.$xbeg; $l2 = $lang['line'].' '.$ybeg; - $r = ''.$l1.":\n" . - ''.$l2.":\n"; + $r = ''.$l1.':\n'. + ' '.$l2.":\n'. + '\n"; return $r; } - function _start_block( $header ) { - print( $header ); + function _start_block($header) { + print($header); } function _end_block() { } - function _lines( $lines, $prefix=' ', $color="white" ) { + function _lines($lines, $prefix=' ', $color="white") { } - function addedLine( $line ) { - return '+' . - $line.''; - + function addedLine($line) { + return '+' . $line.''; } - function deletedLine( $line ) { - return '-' . - $line.''; + function deletedLine($line) { + return '-' . $line.''; } function emptyLine() { return ' '; } - function contextLine( $line ) { + function contextLine($line) { return ' '.$line.''; } function _added($lines) { foreach ($lines as $line) { - print( '' . $this->emptyLine() . - $this->addedLine( $line ) . "\n" ); + print('' . $this->emptyLine() . $this->addedLine($line) . "\n"); } } function _deleted($lines) { foreach ($lines as $line) { - print( '' . $this->deletedLine( $line ) . - $this->emptyLine() . "\n" ); + print('' . $this->deletedLine($line) . $this->emptyLine() . "\n"); } } - function _context( $lines ) { + function _context($lines) { foreach ($lines as $line) { - print( '' . $this->contextLine( $line ) . - $this->contextLine( $line ) . "\n" ); + print('' . $this->contextLine($line) . $this->contextLine($line) . "\n"); } } - function _changed( $orig, $closing ) { - $diff = new WordLevelDiff( $orig, $closing ); + function _changed($orig, $closing) { + $diff = new WordLevelDiff($orig, $closing); $del = $diff->orig(); $add = $diff->closing(); - while ( $line = array_shift( $del ) ) { - $aline = array_shift( $add ); - print( '' . $this->deletedLine( $line ) . - $this->addedLine( $aline ) . "\n" ); + while ($line = array_shift($del)) { + $aline = array_shift($add); + print('' . $this->deletedLine($line) . $this->addedLine($aline) . "\n"); } - $this->_added( $add ); # If any leftovers + $this->_added($add); # If any leftovers } } -- cgit v1.2.3 From 812bb04e971a47bee7e0da80d93831f1660efafb Mon Sep 17 00:00:00 2001 From: Robin Getz Date: Sat, 20 Nov 2010 11:53:38 +0100 Subject: Add support for inline diff formatting This patch only adds the capability to the Difference Engine lib, not to the user interface, yet. --- inc/DifferenceEngine.php | 115 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 115 insertions(+) (limited to 'inc/DifferenceEngine.php') diff --git a/inc/DifferenceEngine.php b/inc/DifferenceEngine.php index 7eae8bd93..a56fe9f6e 100644 --- a/inc/DifferenceEngine.php +++ b/inc/DifferenceEngine.php @@ -838,6 +838,10 @@ class _HWLDF_WordAccumulator { if ($this->_group !== '') { if ($this->_tag == 'mark') $this->_line .= ''.$this->_group.''; + elseif ($this->_tag == 'add') + $this->_line .= ''.$this->_group.''; + elseif ($this->_tag == 'del') + $this->_line .= ''.$this->_group.''; else $this->_line .= $this->_group; } @@ -918,6 +922,42 @@ class WordLevelDiff extends MappedDiff { } } +class InlineWordLevelDiff extends MappedDiff { + + function InlineWordLevelDiff($orig_lines, $closing_lines) { + list ($orig_words, $orig_stripped) = $this->_split($orig_lines); + list ($closing_words, $closing_stripped) = $this->_split($closing_lines); + + $this->MappedDiff($orig_words, $closing_words, $orig_stripped, $closing_stripped); + } + + function _split($lines) { + if (!preg_match_all('/ ( [^\S\n]+ | [0-9_A-Za-z\x80-\xff]+ | . ) (?: (?!< \n) [^\S\n])? /xs', + implode("\n", $lines), $m)) { + return array(array(''), array('')); + } + return array($m[0], $m[1]); + } + + function inline() { + $orig = new _HWLDF_WordAccumulator; + foreach ($this->edits as $edit) { + if ($edit->type == 'copy') + $orig->addWords($edit->orig); + elseif ($edit->type == 'change'){ + $orig->addWords($edit->orig, 'del'); + $orig->addWords($edit->closing, 'add'); + } elseif ($edit->type == 'delete') + $orig->addWords($edit->orig, 'del'); + elseif ($edit->type == 'add') + $orig->addWords($edit->closing, 'add'); + elseif ($edit->orig) + $orig->addWords($edit->orig, 'del'); + } + return $orig->getLines(); + } +} + /** * "Unified" diff formatter. * @@ -1042,5 +1082,80 @@ class TableDiffFormatter extends DiffFormatter { } } +/** + * Inline style diff formatter. + * + */ +class InlineDiffFormatter extends DiffFormatter { + + function InlineDiffFormatter() { + $this->leading_context_lines = 2; + $this->trailing_context_lines = 2; + } + + function format($diff) { + // Preserve whitespaces by converting some to non-breaking spaces. + // Do not convert all of them to allow word-wrap. + $val = parent::format($diff); + $val = str_replace(' ','  ', $val); + $val = preg_replace('/ (?=<)|(?<=[ >]) /', ' ', $val); + return $val; + } + + function _pre($text){ + $text = htmlspecialchars($text); + return $text; + } + + function _block_header($xbeg, $xlen, $ybeg, $ylen) { + global $lang; + if ($xlen != 1) + $xbeg .= "," . $xlen; + if ($ylen != 1) + $ybeg .= "," . $ylen; + $r = '@@ '.$lang['line']." -$xbeg +$ybeg @@"; + $r .= ' '.$lang['deleted'].''; + $r .= ' '.$lang['created'].''; + $r .= "\n"; + return $r; + } + + function _start_block($header) { + print($header."\n"); + } + + function _end_block() { + } + + function _lines($lines, $prefix=' ', $color="white") { + } + + function _added($lines) { + foreach ($lines as $line) { + print(''. $line . "\n"); + } + } + + function _deleted($lines) { + foreach ($lines as $line) { + print('' . $line . "\n"); + } + } + + function _context($lines) { + foreach ($lines as $line) { + print(''.$line."\n"); + } + } + + function _changed($orig, $closing) { + $diff = new InlineWordLevelDiff($orig, $closing); + $add = $diff->inline(); + + foreach ($add as $line) + print(''.$line."\n"); + } +} + //Setup VIM: ex: et ts=4 enc=utf-8 : -- cgit v1.2.3 From 5e1ee188750eca4ed2f13227ede216598c9669c8 Mon Sep 17 00:00:00 2001 From: Xin LI Date: Sun, 7 Nov 2010 02:59:21 +0800 Subject: Fix unicode handling. Suggested by: MQ Signed-off-by: Xin LI --- inc/DifferenceEngine.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'inc/DifferenceEngine.php') diff --git a/inc/DifferenceEngine.php b/inc/DifferenceEngine.php index a56fe9f6e..1ff6a9fba 100644 --- a/inc/DifferenceEngine.php +++ b/inc/DifferenceEngine.php @@ -890,7 +890,7 @@ class WordLevelDiff extends MappedDiff { } function _split($lines) { - if (!preg_match_all('/ ( [^\S\n]+ | [0-9_A-Za-z\x80-\xff]+ | . ) (?: (?!< \n) [^\S\n])? /xs', + if (!preg_match_all('/ ( [^\S\n]+ | [0-9_A-Za-z\x80-\xff]+ | . ) (?: (?!< \n) [^\S\n])? /xsu', implode("\n", $lines), $m)) { return array(array(''), array('')); } -- cgit v1.2.3 From e3776c06c37cc197709dac60892604dfea894ac2 Mon Sep 17 00:00:00 2001 From: Michael Hamann Date: Mon, 29 Nov 2010 01:34:36 +0100 Subject: Remove enc=utf-8 in VIM modeline as it is not allowed in VIM 7.3 As of VIM 7.3 it is no longer possible to specify the encoding in the modeline. This gives an error message whenever such a file is opened, thus this commit removes the enc setting from the modeline. --- inc/DifferenceEngine.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'inc/DifferenceEngine.php') diff --git a/inc/DifferenceEngine.php b/inc/DifferenceEngine.php index 1ff6a9fba..08e09c65f 100644 --- a/inc/DifferenceEngine.php +++ b/inc/DifferenceEngine.php @@ -1158,4 +1158,4 @@ class InlineDiffFormatter extends DiffFormatter { } -//Setup VIM: ex: et ts=4 enc=utf-8 : +//Setup VIM: ex: et ts=4 : -- cgit v1.2.3 From 5048c277bbf430c50bf87cd17ef1e5e21fcb095a Mon Sep 17 00:00:00 2001 From: Anika Henke Date: Mon, 6 Dec 2010 19:47:43 +0000 Subject: fixed newlines nesting error (introduced by 7deca91b) --- inc/DifferenceEngine.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'inc/DifferenceEngine.php') diff --git a/inc/DifferenceEngine.php b/inc/DifferenceEngine.php index 08e09c65f..dd096a55a 100644 --- a/inc/DifferenceEngine.php +++ b/inc/DifferenceEngine.php @@ -1019,9 +1019,9 @@ class TableDiffFormatter extends DiffFormatter { global $lang; $l1 = $lang['line'].' '.$xbeg; $l2 = $lang['line'].' '.$ybeg; - $r = ''.$l1.':\n'. - ' '.$l2.":\n'. - '\n"; + $r = ''.$l1.":\n". + ' '.$l2.":\n". + "\n"; return $r; } -- cgit v1.2.3 From c5982caa2e7089b1ace770dab8da1de167fa2f94 Mon Sep 17 00:00:00 2001 From: Danny Lin Date: Sun, 23 Jan 2011 16:50:04 +0800 Subject: InlineWordLevelDiff regex should be /xsu - FS#2142 --- inc/DifferenceEngine.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'inc/DifferenceEngine.php') diff --git a/inc/DifferenceEngine.php b/inc/DifferenceEngine.php index dd096a55a..1e1d4c3a3 100644 --- a/inc/DifferenceEngine.php +++ b/inc/DifferenceEngine.php @@ -932,7 +932,7 @@ class InlineWordLevelDiff extends MappedDiff { } function _split($lines) { - if (!preg_match_all('/ ( [^\S\n]+ | [0-9_A-Za-z\x80-\xff]+ | . ) (?: (?!< \n) [^\S\n])? /xs', + if (!preg_match_all('/ ( [^\S\n]+ | [0-9_A-Za-z\x80-\xff]+ | . ) (?: (?!< \n) [^\S\n])? /xsu', implode("\n", $lines), $m)) { return array(array(''), array('')); } -- cgit v1.2.3 From c495dc45dedcf43c372ac75d0f966501950bfb6e Mon Sep 17 00:00:00 2001 From: Andreas Gohr Date: Mon, 31 Jan 2011 13:59:22 +0100 Subject: Added colspan option for the InlineDiffFormatter --- inc/DifferenceEngine.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'inc/DifferenceEngine.php') diff --git a/inc/DifferenceEngine.php b/inc/DifferenceEngine.php index 1e1d4c3a3..36322d222 100644 --- a/inc/DifferenceEngine.php +++ b/inc/DifferenceEngine.php @@ -1087,6 +1087,7 @@ class TableDiffFormatter extends DiffFormatter { * */ class InlineDiffFormatter extends DiffFormatter { + var $colspan = 4; function InlineDiffFormatter() { $this->leading_context_lines = 2; @@ -1113,7 +1114,7 @@ class InlineDiffFormatter extends DiffFormatter { $xbeg .= "," . $xlen; if ($ylen != 1) $ybeg .= "," . $ylen; - $r = '@@ '.$lang['line']." -$xbeg +$ybeg @@"; + $r = '@@ '.$lang['line']." -$xbeg +$ybeg @@"; $r .= ' '.$lang['deleted'].''; $r .= ' '.$lang['created'].''; $r .= "\n"; @@ -1132,19 +1133,19 @@ class InlineDiffFormatter extends DiffFormatter { function _added($lines) { foreach ($lines as $line) { - print(''. $line . "\n"); + print(''. $line . "\n"); } } function _deleted($lines) { foreach ($lines as $line) { - print('' . $line . "\n"); + print('' . $line . "\n"); } } function _context($lines) { foreach ($lines as $line) { - print(''.$line."\n"); + print(''.$line."\n"); } } @@ -1153,7 +1154,7 @@ class InlineDiffFormatter extends DiffFormatter { $add = $diff->inline(); foreach ($add as $line) - print(''.$line."\n"); + print(''.$line."\n"); } } -- cgit v1.2.3 From 4f2305cb147b801ff6ef57ed417a366a83e2d92e Mon Sep 17 00:00:00 2001 From: Adrian Lang Date: Sun, 6 Feb 2011 16:49:20 +0100 Subject: Fix whitespace handling in inline diff (closes FS#2161) --- inc/DifferenceEngine.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'inc/DifferenceEngine.php') diff --git a/inc/DifferenceEngine.php b/inc/DifferenceEngine.php index 36322d222..906a17b2d 100644 --- a/inc/DifferenceEngine.php +++ b/inc/DifferenceEngine.php @@ -943,7 +943,7 @@ class InlineWordLevelDiff extends MappedDiff { $orig = new _HWLDF_WordAccumulator; foreach ($this->edits as $edit) { if ($edit->type == 'copy') - $orig->addWords($edit->orig); + $orig->addWords($edit->closing); elseif ($edit->type == 'change'){ $orig->addWords($edit->orig, 'del'); $orig->addWords($edit->closing, 'add'); -- cgit v1.2.3