Skip to content

Commit

Permalink
Fix repeating class assignment of line header
Browse files Browse the repository at this point in the history
Line headers of each equal or inserted line were given a class where it
was supposed to be only the first line.
  • Loading branch information
DigiLive authored and DigiLive committed Mar 27, 2021
1 parent acbfd7d commit fb32453
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions lib/jblond/Diff/Renderer/Html/Merged.php
Original file line number Diff line number Diff line change
Expand Up @@ -125,11 +125,12 @@ public function generateSkippedLines(): string
*/
public function generateLinesEqual(array $changes): string
{
$html = '';
$headerClass = '';
$html = '';

foreach ($changes['base']['lines'] as $lineNo => $line) {
$fromLine = $changes['base']['offset'] + $lineNo + 1 + $this->lineOffset;
$fromLine = $changes['base']['offset'] + $lineNo + 1 + $this->lineOffset;
$headerClass = '';

if (!$lineNo && $this->lastDeleted !== null) {
$headerClass = 'ChangeDelete';
}
Expand All @@ -153,12 +154,12 @@ public function generateLinesEqual(array $changes): string
*/
public function generateLinesInsert(array $changes): string
{
$html = '';
$headerClass = '';
$html = '';

foreach ($changes['changed']['lines'] as $lineNo => $line) {
$this->lineOffset++;
$toLine = $changes['base']['offset'] + $this->lineOffset;
$toLine = $changes['base']['offset'] + $this->lineOffset;
$headerClass = '';
if (!$lineNo && $this->lastDeleted !== null) {
$headerClass = 'ChangeDelete';
}
Expand Down

0 comments on commit fb32453

Please sign in to comment.