baraja-core / baraja-core/simple-php-diff

Difference in last line does not get handled

Open
#7 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
PHP
Stars
11
Forks
2
PR merge metrics
No merged PRs in 30d

Description

### Bug Description
See title.
`getChangedLines()` does return the correct line numbers.

### Steps To Reproduce
Put a difference in the last line.

### Expected Behavior
The change in the last line should be displayed when calling `getDiff()` or `renderDiff()`.

### Possible Solution
`$captureLine` only gets pushed onto `$return` when a line is equal. When the last line is reached and differs, the for loop is already ending and the capture buffer is not checked anymore.

Seems to work when putting a copy of the `if ($captureBuffer !== [])` block before the `return`.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.