Changeset View
Changeset View
Standalone View
Standalone View
src/utils/PhutilProseDifferenceEngine.php
Show All 22 Lines | private function buildDiff(PhutilProseDiff $diff, $u, $v, $level) { | ||||
$matrix = id(new PhutilEditDistanceMatrix()) | $matrix = id(new PhutilEditDistanceMatrix()) | ||||
->setSequences($u_parts, $v_parts) | ->setSequences($u_parts, $v_parts) | ||||
->setComputeString(true); | ->setComputeString(true); | ||||
// For word-level and character-level changes, smooth the output string | // For word-level and character-level changes, smooth the output string | ||||
// to reduce the choppiness of the diff. | // to reduce the choppiness of the diff. | ||||
if ($level > 1) { | if ($level > 1) { | ||||
$matrix->setApplySmoothing(true); | $matrix->setApplySmoothing(PhutilEditDistanceMatrix::SMOOTHING_FULL); | ||||
} | } | ||||
$u_pos = 0; | $u_pos = 0; | ||||
$v_pos = 0; | $v_pos = 0; | ||||
$edits = $matrix->getEditString(); | $edits = $matrix->getEditString(); | ||||
$edits_length = strlen($edits); | $edits_length = strlen($edits); | ||||
▲ Show 20 Lines • Show All 65 Lines • Show Last 20 Lines |