DiffTextView.st
changeset 313 c143d37be2e9
parent 242 85bf88a27903
child 318 2a2009875ee4
--- a/DiffTextView.st	Tue Dec 19 10:54:17 1995 +0100
+++ b/DiffTextView.st	Wed Dec 20 15:32:54 1995 +0100
@@ -11,11 +11,12 @@
 "
 
 TwoColumnTextView subclass:#DiffTextView
-	 instanceVariableNames:'useColors showSeparators addedColor addedBgColor removedColor
-                removedBgColor changedColor changedBgColor'
-	 classVariableNames:''
-	 poolDictionaries:''
-	 category:'Views-Text'
+	instanceVariableNames:'useColors showSeparators addedColor addedBgColor removedColor
+		removedBgColor changedColor changedBgColor changedSpacesOnlyColor
+		changedSpacesOnlyBgColor'
+	classVariableNames:''
+	poolDictionaries:''
+	category:'Views-Text'
 !
 
 !DiffTextView class methodsFor:'documentation'!
@@ -144,19 +145,22 @@
 
     useColors := ColoredListEntry notNil.
     useColors ifTrue:[
-	device hasColors ifTrue:[
-	    addedColor := Color black.
-	    addedBgColor := Color green.
+        device hasColors ifTrue:[
+            addedColor := Color black.
+            addedBgColor := Color green.
 
-	    removedColor := Color white.
-	    removedBgColor := Color red.
+            removedColor := Color white.
+            removedBgColor := Color red.
 
-	    changedColor := Color white.
-	    changedBgColor := Color blue.
-	] ifFalse:[
-	    addedBgColor := removedBgColor := changedBgColor := Color black.
-	    addedColor := removedColor := changedColor := Color white.
-	]
+            changedColor := Color white.
+            changedBgColor := Color blue.
+
+            changedSpacesOnlyColor := Color white.
+            changedSpacesOnlyBgColor := Color blue lightened.
+        ] ifFalse:[
+            addedBgColor := removedBgColor := changedBgColor := Color black.
+            addedColor := removedColor := changedColor := Color white.
+        ]
     ].
 
     "Created: 16.11.1995 / 16:59:48 / cg"
@@ -301,7 +305,13 @@
             state == #changed ifTrue:[
                 (entry at:1) == $< ifTrue:[
                     useColors ifTrue:[
-                        l1 add:(ColoredListEntry string:(text1 at:idx1) foregroundColor:changedColor backgroundColor:changedBgColor).
+                        (l2 size >= idx1
+                        and:[(l2 at:idx1) asString withoutSeparators = (text1 at:idx1) withoutSeparators]) ifTrue:[
+                            l1 add:(ColoredListEntry string:(text1 at:idx1) foregroundColor:changedSpacesOnlyColor backgroundColor:changedSpacesOnlyBgColor).
+                            l2 at:idx1 put:(ColoredListEntry string:(l2 at:idx1) asString foregroundColor:changedSpacesOnlyColor backgroundColor:changedSpacesOnlyBgColor).
+                        ] ifFalse:[
+                            l1 add:(ColoredListEntry string:(text1 at:idx1) foregroundColor:changedColor backgroundColor:changedBgColor).
+                        ]
                     ] ifFalse:[
                         l1 add:(text1 at:idx1).
                     ].
@@ -309,7 +319,13 @@
                 ] ifFalse:[
                     (entry at:1) == $> ifTrue:[
                         useColors ifTrue:[
-                            l2 add:(ColoredListEntry string:(text2 at:idx2) foregroundColor:changedColor backgroundColor:changedBgColor)
+                            (l1 size >= idx2
+                            and:[(l1 at:idx2) asString withoutSeparators = (text2 at:idx2) withoutSeparators]) ifTrue:[
+                                l2 add:(ColoredListEntry string:(text2 at:idx2) foregroundColor:changedSpacesOnlyColor backgroundColor:changedSpacesOnlyBgColor).
+                                l1 at:idx2 put:(ColoredListEntry string:(l1 at:idx2) asString foregroundColor:changedSpacesOnlyColor backgroundColor:changedSpacesOnlyBgColor).
+                            ] ifFalse:[
+                                l2 add:(ColoredListEntry string:(text2 at:idx2) foregroundColor:changedColor backgroundColor:changedBgColor)
+                            ]
                         ] ifFalse:[
                             l2 add:(text2 at:idx2).
                         ].
@@ -372,4 +388,4 @@
 !DiffTextView class methodsFor:'documentation'!
 
 version
-^ '$Header: /cvs/stx/stx/libtool/DiffTextView.st,v 1.13 1995-12-07 09:47:34 cg Exp $'! !
+^ '$Header: /cvs/stx/stx/libtool/DiffTextView.st,v 1.14 1995-12-20 14:32:54 cg Exp $'! !