Skip to content

Commit 02cf114

Browse files
committed
Optimize colorize is only used here
1 parent f5ce6bc commit 02cf114

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

lib/jblond/Diff/Renderer/Text/InlineCli.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -198,10 +198,6 @@ private function mergeChanges(
198198
max($this->maxLineMarkerWidth - strlen($this->options['equalityMarkers'][1]), 0)
199199
);
200200

201-
if ($this->options['cliColor']) {
202-
$colorize = new CliColors();
203-
}
204-
205201
foreach ($baseLines as $lineKey => $line) {
206202
$iterator = 0;
207203
$baselineParts = preg_split('/\x00(.*?)\x01/', $line, -1, PREG_SPLIT_DELIM_CAPTURE);
@@ -220,7 +216,7 @@ private function mergeChanges(
220216
}
221217

222218
if ($this->options['cliColor']) {
223-
// Colorize the changed part. $colorize is defined above.
219+
$colorize = new CliColors();
224220
$basePart = $colorize->getColoredString($basePart, ...$deleteColors);
225221
if (!empty($changedPart)) {
226222
$changedPart = $colorize->getColoredString($changedPart, ...$insertColors);

0 commit comments

Comments
 (0)