9 * |
9 * |
10 * @package Text_Diff |
10 * @package Text_Diff |
11 */ |
11 */ |
12 class Text_Diff_Renderer_unified extends Text_Diff_Renderer { |
12 class Text_Diff_Renderer_unified extends Text_Diff_Renderer { |
13 |
13 |
14 /** |
14 /** |
15 * Number of leading context "lines" to preserve. |
15 * Number of leading context "lines" to preserve. |
16 */ |
16 */ |
17 var $_leading_context_lines = 4; |
17 var $_leading_context_lines = 4; |
18 |
18 |
19 /** |
19 /** |
20 * Number of trailing context "lines" to preserve. |
20 * Number of trailing context "lines" to preserve. |
21 */ |
21 */ |
22 var $_trailing_context_lines = 4; |
22 var $_trailing_context_lines = 4; |
23 |
23 |
24 function _blockHeader($xbeg, $xlen, $ybeg, $ylen) |
24 function _blockHeader($xbeg, $xlen, $ybeg, $ylen) |
25 { |
25 { |
26 if ($xlen != 1) { |
26 if ($xlen != 1) { |
27 $xbeg .= ',' . $xlen; |
27 $xbeg .= ',' . $xlen; |
28 } |
28 } |
29 if ($ylen != 1) { |
29 if ($ylen != 1) { |
30 $ybeg .= ',' . $ylen; |
30 $ybeg .= ',' . $ylen; |
31 } |
31 } |
32 return "@@ -$xbeg +$ybeg @@"; |
32 return "@@ -$xbeg +$ybeg @@"; |
33 } |
33 } |
34 |
34 |
35 function _added($lines) |
35 function _added($lines) |
36 { |
36 { |
37 return $this->_lines($lines, '+'); |
37 return $this->_lines($lines, '+'); |
38 } |
38 } |
39 |
39 |
40 function _deleted($lines) |
40 function _deleted($lines) |
41 { |
41 { |
42 return $this->_lines($lines, '-'); |
42 return $this->_lines($lines, '-'); |
43 } |
43 } |
44 |
44 |
45 function _changed($orig, $final) |
45 function _changed($orig, $final) |
46 { |
46 { |
47 return $this->_deleted($orig) . $this->_added($final); |
47 return $this->_deleted($orig) . $this->_added($final); |
48 } |
48 } |
49 |
49 |
50 } |
50 } |