Differential D20193 Diff 48201 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 63 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(); | ||||
$depths = $this->getDepths(); | $depths = $this->getDepths(); | ||||
$mask = $this->getMask(); | $mask = $this->getMask(); | ||||
foreach ($old_lines as $k => $map) { | |||||
if (!$map['line']) { | |||||
continue; | |||||
} | |||||
$raw = $map['text']; | |||||
$copy = str_replace('o', "\xF0\x9F\x90\x91", $raw); | |||||
if ($copy !== $raw) { | |||||
$old_lines[$k]['raw'] = $copy; | |||||
} | |||||
} | |||||
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. | ||||
$gap = array_pop($gaps); | $gap = array_pop($gaps); | ||||
▲ Show 20 Lines • Show All 57 Lines • ▼ Show 20 Lines | for ($ii = $range_start; $ii < $range_start + $range_len; $ii++) { | ||||
$ii += ($len - 1); | $ii += ($len - 1); | ||||
continue; | continue; | ||||
} | } | ||||
$o_num = null; | $o_num = null; | ||||
$o_classes = ''; | $o_classes = ''; | ||||
$o_text = null; | $o_text = null; | ||||
$o_raw = null; | |||||
if (isset($old_lines[$ii])) { | if (isset($old_lines[$ii])) { | ||||
$o_num = $old_lines[$ii]['line']; | $o_num = $old_lines[$ii]['line']; | ||||
$o_text = isset($old_render[$ii]) ? $old_render[$ii] : null; | $o_text = isset($old_render[$ii]) ? $old_render[$ii] : null; | ||||
if (isset($old_lines[$ii]['raw'])) { | |||||
$o_raw = $old_lines[$ii]['raw']; | |||||
} | |||||
if ($old_lines[$ii]['type']) { | if ($old_lines[$ii]['type']) { | ||||
if ($old_lines[$ii]['type'] == '\\') { | if ($old_lines[$ii]['type'] == '\\') { | ||||
$o_text = $old_lines[$ii]['text']; | $o_text = $old_lines[$ii]['text']; | ||||
$o_class = 'comment'; | $o_class = 'comment'; | ||||
} else if ($original_left && !isset($highlight_old[$o_num])) { | } else if ($original_left && !isset($highlight_old[$o_num])) { | ||||
$o_class = 'old-rebase'; | $o_class = 'old-rebase'; | ||||
} else if (empty($new_lines[$ii])) { | } else if (empty($new_lines[$ii])) { | ||||
$o_class = 'old old-full'; | $o_class = 'old old-full'; | ||||
▲ Show 20 Lines • Show All 141 Lines • ▼ Show 20 Lines | for ($ii = $range_start; $ii < $range_start + $range_len; $ii++) { | ||||
$html[] = phutil_tag('tr', array(), array( | $html[] = phutil_tag('tr', array(), array( | ||||
$old_number, | $old_number, | ||||
phutil_tag( | phutil_tag( | ||||
'td', | 'td', | ||||
array( | array( | ||||
'class' => $o_classes, | 'class' => $o_classes, | ||||
'data-copy-mode' => 'copy-l', | 'data-copy-mode' => 'copy-l', | ||||
'data-copy-text' => $o_raw, | |||||
), | ), | ||||
$o_text), | $o_text), | ||||
$new_number, | $new_number, | ||||
$n_copy, | $n_copy, | ||||
phutil_tag( | phutil_tag( | ||||
'td', | 'td', | ||||
array( | array( | ||||
'class' => $n_classes, | 'class' => $n_classes, | ||||
▲ Show 20 Lines • Show All 105 Lines • Show Last 20 Lines |