Skip to content

Commit b10fd38

Browse files
committed
Fix Undefined offset notice
Inline sequence changes at version 1 where assumed to exist at version 2 also. This isn't true. 1: This is a first sample. 2: this is a sample. Change "first" at 1 doesn't exist at 2. This is an effect of marking inline differences at word level.
1 parent 6b9661c commit b10fd38

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

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

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -219,12 +219,14 @@ private function mergeChanges(
219219

220220
foreach ($baselineParts as $partKey => &$part) {
221221
if ($iterator++ % 2) {
222-
// This part of the line has been changed. Surround it with user defied markers.
222+
// This part of the line has been changed. Surround it with user defined markers.
223223
$basePart = $this->options['deleteMarkers'][0] . $part . $this->options['deleteMarkers'][1];
224-
$changedPart =
225-
$this->options['insertMarkers'][0] .
226-
$changedLineParts[$partKey] .
227-
$this->options['insertMarkers'][1];
224+
if (isset($changedLineParts[$partKey])) {
225+
$changedPart =
226+
$this->options['insertMarkers'][0] .
227+
$changedLineParts[$partKey] .
228+
$this->options['insertMarkers'][1];
229+
}
228230

229231
if ($this->options['cliColor']) {
230232
// Colorize the changed part.

0 commit comments

Comments
 (0)