Differential D20181 Diff 48212 src/applications/differential/render/DifferentialChangesetTwoUpRenderer.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/differential/render/DifferentialChangesetTwoUpRenderer.php
Show First 20 Lines • Show All 65 Lines • ▼ Show 20 Lines | public function renderTextChange( | ||||
$highlight_new = $this->getHighlightNew(); | $highlight_new = $this->getHighlightNew(); | ||||
$old_render = $this->getOldRender(); | $old_render = $this->getOldRender(); | ||||
$new_render = $this->getNewRender(); | $new_render = $this->getNewRender(); | ||||
$original_left = $this->getOriginalOld(); | $original_left = $this->getOriginalOld(); | ||||
$original_right = $this->getOriginalNew(); | $original_right = $this->getOriginalNew(); | ||||
$mask = $this->getMask(); | $mask = $this->getMask(); | ||||
$scope_engine = $this->getScopeEngine(); | $scope_engine = $this->getScopeEngine(); | ||||
$offset_map = null; | $offset_map = null; | ||||
$depth_only = $this->getDepthOnlyLines(); | |||||
for ($ii = $range_start; $ii < $range_start + $range_len; $ii++) { | for ($ii = $range_start; $ii < $range_start + $range_len; $ii++) { | ||||
if (empty($mask[$ii])) { | if (empty($mask[$ii])) { | ||||
// If we aren't going to show this line, we've just entered a gap. | // If we aren't going to show this line, we've just entered a gap. | ||||
// Pop information about the next gap off the $gaps stack and render | // Pop information about the next gap off the $gaps stack and render | ||||
// an appropriate "Show more context" element. This branch eventually | // an appropriate "Show more context" element. This branch eventually | ||||
// increments $ii by the entire size of the gap and then continues | // increments $ii by the entire size of the gap and then continues | ||||
// the loop. | // the loop. | ||||
▲ Show 20 Lines • Show All 107 Lines • ▼ Show 20 Lines | for ($ii = $range_start; $ii < $range_start + $range_len; $ii++) { | ||||
if ($new_lines[$ii]['type'] == '\\') { | if ($new_lines[$ii]['type'] == '\\') { | ||||
$n_text = $new_lines[$ii]['text']; | $n_text = $new_lines[$ii]['text']; | ||||
$n_class = 'comment'; | $n_class = 'comment'; | ||||
} else if ($original_right && !isset($highlight_new[$n_num])) { | } else if ($original_right && !isset($highlight_new[$n_num])) { | ||||
$n_class = 'new-rebase'; | $n_class = 'new-rebase'; | ||||
} else if (empty($old_lines[$ii])) { | } else if (empty($old_lines[$ii])) { | ||||
$n_class = 'new new-full'; | $n_class = 'new new-full'; | ||||
} else { | } else { | ||||
// NOTE: At least for the moment, I'm intentionally clearing the | |||||
// line highlighting only on the right side of the diff when a | |||||
// line has only depth changes. When a block depth is decreased, | |||||
// this gives us a large color block on the left (to make it easy | |||||
// to see the depth change) but a clean diff on the right (to make | |||||
// it easy to pick out actual code changes). | |||||
amckinley: 👍 | |||||
if (isset($depth_only[$ii])) { | |||||
$n_class = ''; | |||||
} else { | |||||
$n_class = 'new'; | $n_class = 'new'; | ||||
} | } | ||||
} | |||||
$n_classes = $n_class; | $n_classes = $n_class; | ||||
if ($new_lines[$ii]['type'] == '\\' || !isset($copy_lines[$n_num])) { | $not_copied = | ||||
// If this line only changed depth, copy markers are pointless. | |||||
(!isset($copy_lines[$n_num])) || | |||||
(isset($depth_only[$ii])) || | |||||
($new_lines[$ii]['type'] == '\\'); | |||||
if ($not_copied) { | |||||
$n_copy = phutil_tag('td', array('class' => "copy {$n_class}")); | $n_copy = phutil_tag('td', array('class' => "copy {$n_class}")); | ||||
} else { | } else { | ||||
list($orig_file, $orig_line, $orig_type) = $copy_lines[$n_num]; | list($orig_file, $orig_line, $orig_type) = $copy_lines[$n_num]; | ||||
$title = ($orig_type == '-' ? 'Moved' : 'Copied').' from '; | $title = ($orig_type == '-' ? 'Moved' : 'Copied').' from '; | ||||
if ($orig_file == '') { | if ($orig_file == '') { | ||||
$title .= "line {$orig_line}"; | $title .= "line {$orig_line}"; | ||||
} else { | } else { | ||||
$title .= | $title .= | ||||
▲ Show 20 Lines • Show All 204 Lines • Show Last 20 Lines |
👍