Zeile 5 | Zeile 5 |
---|
* This class uses the Unix `diff` program via shell_exec to compute the * differences between the two input arrays. *
|
* This class uses the Unix `diff` program via shell_exec to compute the * differences between the two input arrays. *
|
* Copyright 2007-2011 Horde LLC (http://www.horde.org/)
| * Copyright 2007-2017 Horde LLC (http://www.horde.org/)
|
* * See the enclosed file COPYING for license information (LGPL). If you did * not receive this file, see http://www.horde.org/licenses/lgpl21.
| * * See the enclosed file COPYING for license information (LGPL). If you did * not receive this file, see http://www.horde.org/licenses/lgpl21.
|
Zeile 87 | Zeile 87 |
---|
if ($from_line_no < $match[1] || $to_line_no < $match[4]) { // copied lines
|
if ($from_line_no < $match[1] || $to_line_no < $match[4]) { // copied lines
|
assert('$match[1] - $from_line_no == $match[4] - $to_line_no'); array_push($edits,
| assert($match[1] - $from_line_no == $match[4] - $to_line_no); $edits[] =
|
new Horde_Text_Diff_Op_Copy( $this->_getLines($from_lines, $from_line_no, $match[1] - 1),
|
new Horde_Text_Diff_Op_Copy( $this->_getLines($from_lines, $from_line_no, $match[1] - 1),
|
$this->_getLines($to_lines, $to_line_no, $match[4] - 1)));
| $this->_getLines($to_lines, $to_line_no, $match[4] - 1));
|
}
switch ($match[3]) { case 'd': // deleted lines
|
}
switch ($match[3]) { case 'd': // deleted lines
|
array_push($edits,
| $edits[] =
|
new Horde_Text_Diff_Op_Delete(
|
new Horde_Text_Diff_Op_Delete(
|
$this->_getLines($from_lines, $from_line_no, $match[2])));
| $this->_getLines($from_lines, $from_line_no, $match[2]));
|
$to_line_no++; break;
case 'c': // changed lines
|
$to_line_no++; break;
case 'c': // changed lines
|
array_push($edits,
| $edits[] =
|
new Horde_Text_Diff_Op_Change( $this->_getLines($from_lines, $from_line_no, $match[2]),
|
new Horde_Text_Diff_Op_Change( $this->_getLines($from_lines, $from_line_no, $match[2]),
|
$this->_getLines($to_lines, $to_line_no, $match[5])));
| $this->_getLines($to_lines, $to_line_no, $match[5]));
|
break;
case 'a': // added lines
|
break;
case 'a': // added lines
|
array_push($edits,
| $edits[] =
|
new Horde_Text_Diff_Op_Add(
|
new Horde_Text_Diff_Op_Add(
|
$this->_getLines($to_lines, $to_line_no, $match[5])));
| $this->_getLines($to_lines, $to_line_no, $match[5]));
|
$from_line_no++; break; }
| $from_line_no++; break; }
|
Zeile 123 | Zeile 123 |
---|
if (!empty($from_lines)) { // Some lines might still be pending. Add them as copied
|
if (!empty($from_lines)) { // Some lines might still be pending. Add them as copied
|
array_push($edits,
| $edits[] =
|
new Horde_Text_Diff_Op_Copy( $this->_getLines($from_lines, $from_line_no, $from_line_no + count($from_lines) - 1), $this->_getLines($to_lines, $to_line_no,
|
new Horde_Text_Diff_Op_Copy( $this->_getLines($from_lines, $from_line_no, $from_line_no + count($from_lines) - 1), $this->_getLines($to_lines, $to_line_no,
|
$to_line_no + count($to_lines) - 1)));
| $to_line_no + count($to_lines) - 1));
|
}
return $edits;
| }
return $edits;
|
Zeile 152 | Zeile 152 |
---|
$lines = array(); // We can shift even more while ($line_no <= $end) {
|
$lines = array(); // We can shift even more while ($line_no <= $end) {
|
array_push($lines, array_shift($text_lines));
| $lines[] = array_shift($text_lines);
|
$line_no++; } } else {
| $line_no++; } } else {
|