equal
deleted
inserted
replaced
295 |
295 |
296 processDiffList:diffList from:text1 and:text2 |
296 processDiffList:diffList from:text1 and:text2 |
297 "given the two texts in text1 and text2, and the diff-output in diffList, |
297 "given the two texts in text1 and text2, and the diff-output in diffList, |
298 return new left and right lists." |
298 return new left and right lists." |
299 |
299 |
300 |idx1 idx2 dIdx dEnd state s nr1 nr2 nr3 op entry l1 l2 any delta s1 s2 line1 line2| |
300 |idx1 idx2 dIdx dEnd state s nr1 nr2 nr3 op entry l1 l2 any delta s1 s2 line1 line2 common| |
301 |
301 |
302 diffList size == 1 ifTrue:[ |
302 diffList size == 1 ifTrue:[ |
303 ^ { diffList. diffList } |
303 ^ { diffList. diffList } |
304 ]. |
304 ]. |
305 |
305 |
431 line1 := line2 := nil. |
431 line1 := line2 := nil. |
432 (entry at:1) == $< ifTrue:[ |
432 (entry at:1) == $< ifTrue:[ |
433 useColors ifTrue:[ |
433 useColors ifTrue:[ |
434 (l2 size >= idx1 |
434 (l2 size >= idx1 |
435 and:[(s2 := line2 := l2 at:idx1) notNil |
435 and:[(s2 := line2 := l2 at:idx1) notNil |
436 and:[(line2 asString string withoutSeparators = (line1 := text1 at:idx1) asString string withoutSeparators) |
436 and:[(line2 asString string withTabsExpanded withoutSeparators = (line1 := text1 at:idx1) asString string withTabsExpanded withoutSeparators) |
437 "/ or:[(s2 asString withoutSeparators withTabsExpanded = (text1 at:idx1) withoutSeparators withTabsExpanded)] |
437 "/ or:[(s2 asString withoutSeparators withTabsExpanded = (text1 at:idx1) withoutSeparators withTabsExpanded)] |
438 ]]) ifTrue:[ |
438 ]]) ifTrue:[ |
439 line1 := Text string:line1 |
439 line1 := Text string:line1 |
440 foregroundColor:changedSpacesOnlyColor |
440 foregroundColor:changedSpacesOnlyColor |
441 backgroundColor:changedSpacesOnlyBgColor. |
441 backgroundColor:changedSpacesOnlyBgColor. |
468 ] ifFalse:[ |
468 ] ifFalse:[ |
469 (entry at:1) == $> ifTrue:[ |
469 (entry at:1) == $> ifTrue:[ |
470 useColors ifTrue:[ |
470 useColors ifTrue:[ |
471 (l1 size >= idx2 |
471 (l1 size >= idx2 |
472 and:[(s1 := line1 := l1 at:idx2) notNil |
472 and:[(s1 := line1 := l1 at:idx2) notNil |
473 and:[(s1 asString string withoutSeparators = (text2 at:idx2) string withoutSeparators) |
473 and:[(s1 asString string withTabsExpanded withoutSeparators = (text2 at:idx2) string withTabsExpanded withoutSeparators) |
474 "/ or:[(s1 asString withoutSeparators withTabsExpanded = (text2 at:idx2) withoutSeparators withTabsExpanded)] |
474 "/ or:[(s1 asString withoutSeparators withTabsExpanded = (text2 at:idx2) withoutSeparators withTabsExpanded)] |
475 ]]) ifTrue:[ |
475 ]]) ifTrue:[ |
476 line2 := Text string:(text2 at:idx2) |
476 line2 := Text string:(text2 at:idx2) |
477 foregroundColor:changedSpacesOnlyColor |
477 foregroundColor:changedSpacesOnlyColor |
478 backgroundColor:changedSpacesOnlyBgColor. |
478 backgroundColor:changedSpacesOnlyBgColor. |
490 ] |
490 ] |
491 ]. |
491 ]. |
492 l2 add:line2. |
492 l2 add:line2. |
493 l1 at:idx2 put:line1. |
493 l1 at:idx2 put:line1. |
494 ] ifFalse:[ |
494 ] ifFalse:[ |
495 line2 := Text string:(text2 at:idx2) foregroundColor:changedColor backgroundColor:changedBgColor. |
495 line2 := text2 at:idx2. |
|
496 line1 notNil ifTrue:[ |
|
497 common := line1 string commonPrefixWith: line2 string. |
|
498 ] ifFalse:[ |
|
499 common := nil |
|
500 ]. |
|
501 common size > 0 ifTrue:[ |
|
502 line2 := (Text string:common foregroundColor:changedSpacesOnlyColor backgroundColor:changedSpacesOnlyBgColor) |
|
503 , (Text string:(line2 copyFrom:common size+1) foregroundColor:changedColor backgroundColor:changedBgColor). |
|
504 ] ifFalse:[ |
|
505 line2 := Text string:line2 foregroundColor:changedColor backgroundColor:changedBgColor. |
|
506 ]. |
496 l2 add:line2 |
507 l2 add:line2 |
497 ] |
508 ] |
498 ] ifFalse:[ |
509 ] ifFalse:[ |
499 l2 add:(text2 at:idx2). |
510 l2 add:line2. |
500 ]. |
511 ]. |
501 idx2 := idx2 + 1 |
512 idx2 := idx2 + 1 |
502 ] ifFalse:[ |
513 ] ifFalse:[ |
503 (entry at:1) == $- ifTrue:[ |
514 (entry at:1) == $- ifTrue:[ |
504 ] ifFalse:[ |
515 ] ifFalse:[ |
573 ] |
584 ] |
574 ]. |
585 ]. |
575 |
586 |
576 ^ { l1. l2 } |
587 ^ { l1. l2 } |
577 |
588 |
578 "Modified: / 13.7.1999 / 14:12:11 / cg" |
589 "Modified: / 29-11-2017 / 11:06:54 / cg" |
579 ! |
590 ! |
580 |
591 |
581 updateListsFrom:text1 and:text2 diffs:diffList |
592 updateListsFrom:text1 and:text2 diffs:diffList |
582 "given the two texts in text1 and text2, and the diff-output in diffList, |
593 "given the two texts in text1 and text2, and the diff-output in diffList, |
583 update my views contents" |
594 update my views contents" |