oops - care for diff -b space differences
authorClaus Gittinger <cg@exept.de>
Thu, 15 Jul 1999 15:44:16 +0200
changeset 2262 75d490e87d95
parent 2261 aad58c8f7c5a
child 2263 46fc2bb1b9c1
oops - care for diff -b space differences
DiffTextView.st
DiffTxtV.st
--- a/DiffTextView.st	Tue Jul 13 17:48:50 1999 +0200
+++ b/DiffTextView.st	Thu Jul 15 15:44:16 1999 +0200
@@ -434,7 +434,7 @@
                                          foregroundColor:changedSpacesOnlyColor 
                                          backgroundColor:changedSpacesOnlyBgColor.
 
-                            line1 string withoutSeparators = line2 string withoutSeparators ifTrue:[
+                            line1 string withoutTrailingSeparators = line2 string withoutTrailingSeparators ifTrue:[
                                 line1 := line1 string.
                                 line2 := line2 string.
                             ].
@@ -465,7 +465,7 @@
                                 line1 := Text string:line1 asString 
                                             foregroundColor:changedSpacesOnlyColor 
                                             backgroundColor:changedSpacesOnlyBgColor.
-                                line1 string withoutSeparators = line2 string withoutSeparators ifTrue:[
+                                line1 string withoutTrailingSeparators = line2 string withoutTrailingSeparators ifTrue:[
                                     line1 := line1 string.
                                     line2 := line2 string.
                                 ].
@@ -528,6 +528,31 @@
     [l2 size < l1 size] whileTrue:[
         l2 add:''.
     ].
+
+    "/ fixup - diff -b is ignoring lines which differ in leading space only ...
+    1 to:l1 size do:[:idx |
+        |line1 line2|
+
+        line1 := l1 at:idx.
+        line2 := l2 at:idx.
+        line1 hasChangeOfEmphasis not ifTrue:[
+            line2 hasChangeOfEmphasis not ifTrue:[
+                line1 withTabsExpanded withoutTrailingSeparators
+                ~= line2 withTabsExpanded withoutTrailingSeparators 
+                ifTrue:[
+                    line1 := Text string:line1 
+                                 foregroundColor:changedSpacesOnlyColor
+                                 backgroundColor:changedSpacesOnlyBgColor.
+                    line2 := Text string:line2 
+                                 foregroundColor:changedSpacesOnlyColor 
+                                 backgroundColor:changedSpacesOnlyBgColor.
+                    l1 at:idx put:line1.
+                    l2 at:idx put:line2.
+                ]
+            ]        
+        ]
+    ].
+
     textView1 list:l1.
     textView2 list:l2
 
@@ -537,4 +562,4 @@
 !DiffTextView class methodsFor:'documentation'!
 
 version
-^ '$Header: /cvs/stx/stx/libtool/DiffTextView.st,v 1.26 1999-07-13 12:15:05 cg Exp $'! !
+^ '$Header: /cvs/stx/stx/libtool/DiffTextView.st,v 1.27 1999-07-15 13:44:16 cg Exp $'! !
--- a/DiffTxtV.st	Tue Jul 13 17:48:50 1999 +0200
+++ b/DiffTxtV.st	Thu Jul 15 15:44:16 1999 +0200
@@ -434,7 +434,7 @@
                                          foregroundColor:changedSpacesOnlyColor 
                                          backgroundColor:changedSpacesOnlyBgColor.
 
-                            line1 string withoutSeparators = line2 string withoutSeparators ifTrue:[
+                            line1 string withoutTrailingSeparators = line2 string withoutTrailingSeparators ifTrue:[
                                 line1 := line1 string.
                                 line2 := line2 string.
                             ].
@@ -465,7 +465,7 @@
                                 line1 := Text string:line1 asString 
                                             foregroundColor:changedSpacesOnlyColor 
                                             backgroundColor:changedSpacesOnlyBgColor.
-                                line1 string withoutSeparators = line2 string withoutSeparators ifTrue:[
+                                line1 string withoutTrailingSeparators = line2 string withoutTrailingSeparators ifTrue:[
                                     line1 := line1 string.
                                     line2 := line2 string.
                                 ].
@@ -528,6 +528,31 @@
     [l2 size < l1 size] whileTrue:[
         l2 add:''.
     ].
+
+    "/ fixup - diff -b is ignoring lines which differ in leading space only ...
+    1 to:l1 size do:[:idx |
+        |line1 line2|
+
+        line1 := l1 at:idx.
+        line2 := l2 at:idx.
+        line1 hasChangeOfEmphasis not ifTrue:[
+            line2 hasChangeOfEmphasis not ifTrue:[
+                line1 withTabsExpanded withoutTrailingSeparators
+                ~= line2 withTabsExpanded withoutTrailingSeparators 
+                ifTrue:[
+                    line1 := Text string:line1 
+                                 foregroundColor:changedSpacesOnlyColor
+                                 backgroundColor:changedSpacesOnlyBgColor.
+                    line2 := Text string:line2 
+                                 foregroundColor:changedSpacesOnlyColor 
+                                 backgroundColor:changedSpacesOnlyBgColor.
+                    l1 at:idx put:line1.
+                    l2 at:idx put:line2.
+                ]
+            ]        
+        ]
+    ].
+
     textView1 list:l1.
     textView2 list:l2
 
@@ -537,4 +562,4 @@
 !DiffTextView class methodsFor:'documentation'!
 
 version
-^ '$Header: /cvs/stx/stx/libtool/Attic/DiffTxtV.st,v 1.26 1999-07-13 12:15:05 cg Exp $'! !
+^ '$Header: /cvs/stx/stx/libtool/Attic/DiffTxtV.st,v 1.27 1999-07-15 13:44:16 cg Exp $'! !