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

Difference in last line does not get handled

Offen
#7 1 Kommentar 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
PHP
Sterne
11
Forks
2
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

### 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`.

Beitragsleitfaden

Beitragsleitfaden öffnen

Rechercherichtung

Inspect the implementation of getDiff() and renderDiff(), focusing on how the capture buffer is handled after the final line. Reproduce a difference on the last line and verify that the resulting diff includes it; the issue is done when both methods display that final-line change.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
php
Bereich
backend
Issue-Typ
Bug
Schwierigkeit
2/5
Geschätzter Aufwand
1-3 Stunden
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
45/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.