337 entry isNil ifTrue:[ |
337 entry isNil ifTrue:[ |
338 nr1 := text1 size + 1. |
338 nr1 := text1 size + 1. |
339 nr2 := text2 size + 1. |
339 nr2 := text2 size + 1. |
340 state := #finish. |
340 state := #finish. |
341 ] ifFalse:[ |
341 ] ifFalse:[ |
342 diffLineNumbers add:l1 size. |
|
343 |
|
344 s := ReadStream on:entry. |
342 s := ReadStream on:entry. |
345 nr1 := Integer readFrom:s. |
343 nr1 := Integer readFrom:s. |
346 s peek == $, ifTrue:[ |
344 s peek == $, ifTrue:[ |
347 s next. |
345 s next. |
348 Integer readFrom:s |
346 Integer readFrom:s |
398 state == #deleted ifTrue:[ |
397 state == #deleted ifTrue:[ |
399 l2 add:(text2 at:idx2 ifAbsent:''). |
398 l2 add:(text2 at:idx2 ifAbsent:''). |
400 idx2 := idx2 + 1. |
399 idx2 := idx2 + 1. |
401 ]. |
400 ]. |
402 |
401 |
403 |
|
404 " |
402 " |
405 add a separating line, except at end |
403 add a separating line, except at end |
406 " |
404 " |
407 any ifTrue:[ |
405 any ifTrue:[ |
408 state ~~ #finish ifTrue:[ |
406 state ~~ #finish ifTrue:[ |
409 showSeparators ifTrue:[ |
407 showSeparators ifTrue:[ |
410 l1 add:'--------'. |
408 l1 add:'--------'. |
411 l2 add:'--------'. |
409 l2 add:'--------'. |
412 ] |
410 ]. |
413 ] |
411 ] |
414 ]. |
412 ]. |
415 |
|
416 ] ifFalse:[ |
413 ] ifFalse:[ |
417 state == #changed ifTrue:[ |
414 state == #changed ifTrue:[ |
418 line1 := line2 := nil. |
415 line1 := line2 := nil. |
419 (entry at:1) == $< ifTrue:[ |
416 (entry at:1) == $< ifTrue:[ |
420 useColors ifTrue:[ |
417 useColors ifTrue:[ |
576 |
573 |
577 lists := self processDiffList:diffList from:text1 and:text2. |
574 lists := self processDiffList:diffList from:text1 and:text2. |
578 |
575 |
579 textView1 list:lists first. |
576 textView1 list:lists first. |
580 textView2 list:lists second. |
577 textView2 list:lists second. |
|
578 |
|
579 self updateScrollbarBackground |
|
580 ! |
|
581 |
|
582 updateScrollbarBackground |
|
583 "define a background in the scroller allowing quick positioning to changes" |
|
584 |
|
585 |container vScroller thumb| |
|
586 |
|
587 (container := self container) isScrollWrapper ifTrue:[ |
|
588 (vScroller := container verticalScrollBar) notNil ifTrue:[ |
|
589 (thumb := vScroller thumb) notNil ifTrue:[ |
|
590 thumb |
|
591 backgroundDrawHook:[:x :y :w :h | |
|
592 |overAllHeight| |
|
593 |
|
594 overAllHeight := textViews first numberOfLines. |
|
595 1 to:overAllHeight do:[:lineNr | |
|
596 |l1 l2 isDiff yThumb clr e| |
|
597 |
|
598 l1 := textViews first listAt:lineNr. |
|
599 l2 := textViews second listAt:lineNr. |
|
600 (l1 notNil and:[l1 isText]) ifTrue:[ |
|
601 e := l1 emphasis |
|
602 ] ifFalse:[ |
|
603 (l2 notNil and:[l2 isText ]) ifTrue:[ |
|
604 e := l2 emphasis |
|
605 ] |
|
606 ]. |
|
607 e size > 0 ifTrue:[ |
|
608 clr := Text extractEmphasis:#backgroundColor from:(e at:1). |
|
609 thumb paint:clr. |
|
610 yThumb := (thumb height * (lineNr / overAllHeight)) rounded. |
|
611 thumb displayLineFromX:1 y:yThumb toX:thumb width-2 y:yThumb. |
|
612 ]. |
|
613 ] |
|
614 ] |
|
615 ] |
|
616 ] |
|
617 ]. |
581 ! ! |
618 ! ! |
582 |
619 |
583 !DiffTextView class methodsFor:'documentation'! |
620 !DiffTextView class methodsFor:'documentation'! |
584 |
621 |
585 version |
622 version |
586 ^ '$Header: /cvs/stx/stx/libtool/DiffTextView.st,v 1.58 2013-03-11 11:51:45 cg Exp $' |
623 ^ '$Header: /cvs/stx/stx/libtool/DiffTextView.st,v 1.59 2014-01-26 13:54:14 cg Exp $' |
587 ! |
624 ! |
588 |
625 |
589 version_CVS |
626 version_CVS |
590 ^ '$Header: /cvs/stx/stx/libtool/DiffTextView.st,v 1.58 2013-03-11 11:51:45 cg Exp $' |
627 ^ '$Header: /cvs/stx/stx/libtool/DiffTextView.st,v 1.59 2014-01-26 13:54:14 cg Exp $' |
591 ! ! |
628 ! ! |
592 |
629 |