From 3954a2be998431fc2996e1831d9ba18de509ce0f Mon Sep 17 00:00:00 2001 From: DigiLive Date: Thu, 19 Nov 2020 10:40:01 +0100 Subject: [PATCH] Fix probably undefined variable --- lib/jblond/Diff/Renderer/Text/InlineCli.php | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/lib/jblond/Diff/Renderer/Text/InlineCli.php b/lib/jblond/Diff/Renderer/Text/InlineCli.php index 726218e..09dafc8 100644 --- a/lib/jblond/Diff/Renderer/Text/InlineCli.php +++ b/lib/jblond/Diff/Renderer/Text/InlineCli.php @@ -210,7 +210,8 @@ private function mergeChanges( foreach ($baselineParts as $partKey => &$part) { if ($iterator++ % 2) { // This part of the line has been changed. Surround it with user defined markers. - $basePart = $this->options['deleteMarkers'][0] . $part . $this->options['deleteMarkers'][1]; + $basePart = $this->options['deleteMarkers'][0] . $part . $this->options['deleteMarkers'][1]; + $changedPart = ''; if (isset($changedLineParts[$partKey])) { $changedPart = $this->options['insertMarkers'][0] . @@ -219,13 +220,13 @@ private function mergeChanges( } if ($this->options['cliColor']) { - // Colorize the changed part. - [$fgColor, $bgColor] = $deleteColors; - $basePart = $colorize->getColoredString($basePart, $fgColor, $bgColor); - [$fgColor, $bgColor] = $insertColors; - $changedPart = $colorize->getColoredString($changedPart, $fgColor, $bgColor); // FIXME + // Colorize the changed part. $colorize is defined above. + $basePart = $colorize->getColoredString($basePart, ...$deleteColors); + if (!empty($changedPart)) { + $changedPart = $colorize->getColoredString($changedPart, ...$insertColors); + } } - $part = $basePart . $changedPart; // FIXME + $part = $basePart . $changedPart; } } unset($part);