Skip to content

Commit

Permalink
Optimize colorize is only used here
Browse files Browse the repository at this point in the history
  • Loading branch information
JBlond committed Aug 24, 2021
1 parent f5ce6bc commit 02cf114
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions lib/jblond/Diff/Renderer/Text/InlineCli.php
Original file line number Diff line number Diff line change
Expand Up @@ -198,10 +198,6 @@ private function mergeChanges(
max($this->maxLineMarkerWidth - strlen($this->options['equalityMarkers'][1]), 0)
);

if ($this->options['cliColor']) {
$colorize = new CliColors();
}

foreach ($baseLines as $lineKey => $line) {
$iterator = 0;
$baselineParts = preg_split('/\x00(.*?)\x01/', $line, -1, PREG_SPLIT_DELIM_CAPTURE);
Expand All @@ -220,7 +216,7 @@ private function mergeChanges(
}

if ($this->options['cliColor']) {
// Colorize the changed part. $colorize is defined above.
$colorize = new CliColors();
$basePart = $colorize->getColoredString($basePart, ...$deleteColors);
if (!empty($changedPart)) {
$changedPart = $colorize->getColoredString($changedPart, ...$insertColors);
Expand Down

0 comments on commit 02cf114

Please sign in to comment.