Changeset View
Changeset View
Standalone View
Standalone View
src/utils/PhutilProseDifferenceEngine.php
| Show All 12 Lines | final class PhutilProseDifferenceEngine extends Phobject { | ||||
| private function buildDiff(PhutilProseDiff $diff, $u, $v, $level) { | private function buildDiff(PhutilProseDiff $diff, $u, $v, $level) { | ||||
| if ($level == 4) { | if ($level == 4) { | ||||
| $diff->addPart('-', $u); | $diff->addPart('-', $u); | ||||
| $diff->addPart('+', $v); | $diff->addPart('+', $v); | ||||
| return; | return; | ||||
| } | } | ||||
| $u_parts = $this->splitCorpus($u, $level); | $u_parts = $this->splitCorpus($u, $level); | ||||
| $v_parts = $this->splitCorpus($v, $level); | $v_parts = $this->splitCorpus($v, $level); | ||||
wizsrk: this is also test | |||||
| $matrix = id(new PhutilEditDistanceMatrix()) | $matrix = id(new PhutilEditDistanceMatrix()) | ||||
| ->setMaximumLength(128) | |||||
| ->setSequences($u_parts, $v_parts) | ->setSequences($u_parts, $v_parts) | ||||
| ->setComputeString(true); | ->setComputeString(true); | ||||
wizsrkUnsubmitted Not Done Inline Actionsplease ignore this, just a test wizsrk: please ignore this, just a test | |||||
| // 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(PhutilEditDistanceMatrix::SMOOTHING_FULL); | $matrix->setApplySmoothing(PhutilEditDistanceMatrix::SMOOTHING_FULL); | ||||
| } | } | ||||
| $u_pos = 0; | $u_pos = 0; | ||||
| $v_pos = 0; | $v_pos = 0; | ||||
| ▲ Show 20 Lines • Show All 69 Lines • Show Last 20 Lines | |||||
this is also test