fix for win32 diff (which does not support -b option)
authorClaus Gittinger <cg@exept.de>
Tue, 13 Jul 1999 14:15:05 +0200
changeset 2260 2c093fe9ddb1
parent 2259 d8c1dbd55fd4
child 2261 aad58c8f7c5a
fix for win32 diff (which does not support -b option)
DiffTextView.st
DiffTxtV.st
--- a/DiffTextView.st	Mon Jul 12 19:55:51 1999 +0200
+++ b/DiffTextView.st	Tue Jul 13 14:15:05 1999 +0200
@@ -286,7 +286,7 @@
      update my views contents"
 
     |idx1 idx2 dIdx dEnd state s nr1 nr2 nr3 op entry c l1 l2 any delta
-     textView1 textView2 s1 s2|
+     textView1 textView2 s1 s2 line1 line2|
 
     diffLineNumbers := OrderedCollection new.
 
@@ -419,23 +419,33 @@
 
         ] ifFalse:[
             state == #changed ifTrue:[
+                line1 := line2 := nil.
                 (entry at:1) == $< ifTrue:[
                     useColors ifTrue:[
                         (l2 size >= idx1
-                        and:[(s2 := l2 at:idx1) notNil
+                        and:[(s2 := line2 := l2 at:idx1) notNil
                         and:[(s2 asString withoutSeparators = (text1 at:idx1) withoutSeparators)
                               "/ or:[(s2 asString withoutSeparators withTabsExpanded = (text1 at:idx1) withoutSeparators withTabsExpanded)]  
                         ]]) ifTrue:[
-                            l1 add:(Text string:(text1 at:idx1) 
+                            line1 := Text string:(text1 at:idx1) 
                                          foregroundColor:changedSpacesOnlyColor
-                                         backgroundColor:changedSpacesOnlyBgColor).
-                            l2 at:idx1 put:(Text string:(l2 at:idx1) asString 
-                                                 foregroundColor:changedSpacesOnlyColor 
-                                                 backgroundColor:changedSpacesOnlyBgColor).
+                                         backgroundColor:changedSpacesOnlyBgColor.
+                            line2 := Text string:line2 asString 
+                                         foregroundColor:changedSpacesOnlyColor 
+                                         backgroundColor:changedSpacesOnlyBgColor.
+
+                            line1 string withoutSeparators = line2 string withoutSeparators ifTrue:[
+                                line1 := line1 string.
+                                line2 := line2 string.
+                            ].
+
+                            l1 add:line1.
+                            l2 at:idx1 put:line2.
                         ] ifFalse:[
-                            l1 add:(Text string:(text1 at:idx1) 
+                            line1 := Text string:(text1 at:idx1) 
                                          foregroundColor:changedColor 
-                                         backgroundColor:changedBgColor).
+                                         backgroundColor:changedBgColor.
+                            l1 add:line1.
                         ]
                     ] ifFalse:[
                         l1 add:(text1 at:idx1).
@@ -445,14 +455,25 @@
                     (entry at:1) == $> ifTrue:[
                         useColors ifTrue:[
                             (l1 size >= idx2
-                            and:[(s1 := l1 at:idx2) notNil
+                            and:[(s1 := line1 := l1 at:idx2) notNil
                             and:[(s1 asString withoutSeparators = (text2 at:idx2) withoutSeparators)
                                   "/ or:[(s1 asString withoutSeparators withTabsExpanded = (text2 at:idx2) withoutSeparators withTabsExpanded)]  
                             ]]) ifTrue:[
-                                l2 add:(Text string:(text2 at:idx2) foregroundColor:changedSpacesOnlyColor backgroundColor:changedSpacesOnlyBgColor).
-                                l1 at:idx2 put:(Text string:(l1 at:idx2) asString foregroundColor:changedSpacesOnlyColor backgroundColor:changedSpacesOnlyBgColor).
+                                line2 := Text string:(text2 at:idx2) 
+                                            foregroundColor:changedSpacesOnlyColor 
+                                            backgroundColor:changedSpacesOnlyBgColor.
+                                line1 := Text string:line1 asString 
+                                            foregroundColor:changedSpacesOnlyColor 
+                                            backgroundColor:changedSpacesOnlyBgColor.
+                                line1 string withoutSeparators = line2 string withoutSeparators ifTrue:[
+                                    line1 := line1 string.
+                                    line2 := line2 string.
+                                ].
+                                l2 add:line2.
+                                l1 at:idx2 put:line1.
                             ] ifFalse:[
-                                l2 add:(Text string:(text2 at:idx2) foregroundColor:changedColor backgroundColor:changedBgColor)
+                                line2 := Text string:(text2 at:idx2) foregroundColor:changedColor backgroundColor:changedBgColor.
+                                l2 add:line2
                             ]
                         ] ifFalse:[
                             l2 add:(text2 at:idx2).
@@ -465,7 +486,7 @@
                             dIdx := dIdx - 1
                         ]
                     ]
-                ]
+                ].
             ] ifFalse:[
                 state == #added ifTrue:[
                     (entry at:1) == $> ifTrue:[
@@ -510,10 +531,10 @@
     textView1 list:l1.
     textView2 list:l2
 
-    "Modified: / 5.5.1999 / 16:08:03 / cg"
+    "Modified: / 13.7.1999 / 14:12:11 / cg"
 ! !
 
 !DiffTextView class methodsFor:'documentation'!
 
 version
-^ '$Header: /cvs/stx/stx/libtool/DiffTextView.st,v 1.25 1999-07-09 14:56:18 cg Exp $'! !
+^ '$Header: /cvs/stx/stx/libtool/DiffTextView.st,v 1.26 1999-07-13 12:15:05 cg Exp $'! !
--- a/DiffTxtV.st	Mon Jul 12 19:55:51 1999 +0200
+++ b/DiffTxtV.st	Tue Jul 13 14:15:05 1999 +0200
@@ -286,7 +286,7 @@
      update my views contents"
 
     |idx1 idx2 dIdx dEnd state s nr1 nr2 nr3 op entry c l1 l2 any delta
-     textView1 textView2 s1 s2|
+     textView1 textView2 s1 s2 line1 line2|
 
     diffLineNumbers := OrderedCollection new.
 
@@ -419,23 +419,33 @@
 
         ] ifFalse:[
             state == #changed ifTrue:[
+                line1 := line2 := nil.
                 (entry at:1) == $< ifTrue:[
                     useColors ifTrue:[
                         (l2 size >= idx1
-                        and:[(s2 := l2 at:idx1) notNil
+                        and:[(s2 := line2 := l2 at:idx1) notNil
                         and:[(s2 asString withoutSeparators = (text1 at:idx1) withoutSeparators)
                               "/ or:[(s2 asString withoutSeparators withTabsExpanded = (text1 at:idx1) withoutSeparators withTabsExpanded)]  
                         ]]) ifTrue:[
-                            l1 add:(Text string:(text1 at:idx1) 
+                            line1 := Text string:(text1 at:idx1) 
                                          foregroundColor:changedSpacesOnlyColor
-                                         backgroundColor:changedSpacesOnlyBgColor).
-                            l2 at:idx1 put:(Text string:(l2 at:idx1) asString 
-                                                 foregroundColor:changedSpacesOnlyColor 
-                                                 backgroundColor:changedSpacesOnlyBgColor).
+                                         backgroundColor:changedSpacesOnlyBgColor.
+                            line2 := Text string:line2 asString 
+                                         foregroundColor:changedSpacesOnlyColor 
+                                         backgroundColor:changedSpacesOnlyBgColor.
+
+                            line1 string withoutSeparators = line2 string withoutSeparators ifTrue:[
+                                line1 := line1 string.
+                                line2 := line2 string.
+                            ].
+
+                            l1 add:line1.
+                            l2 at:idx1 put:line2.
                         ] ifFalse:[
-                            l1 add:(Text string:(text1 at:idx1) 
+                            line1 := Text string:(text1 at:idx1) 
                                          foregroundColor:changedColor 
-                                         backgroundColor:changedBgColor).
+                                         backgroundColor:changedBgColor.
+                            l1 add:line1.
                         ]
                     ] ifFalse:[
                         l1 add:(text1 at:idx1).
@@ -445,14 +455,25 @@
                     (entry at:1) == $> ifTrue:[
                         useColors ifTrue:[
                             (l1 size >= idx2
-                            and:[(s1 := l1 at:idx2) notNil
+                            and:[(s1 := line1 := l1 at:idx2) notNil
                             and:[(s1 asString withoutSeparators = (text2 at:idx2) withoutSeparators)
                                   "/ or:[(s1 asString withoutSeparators withTabsExpanded = (text2 at:idx2) withoutSeparators withTabsExpanded)]  
                             ]]) ifTrue:[
-                                l2 add:(Text string:(text2 at:idx2) foregroundColor:changedSpacesOnlyColor backgroundColor:changedSpacesOnlyBgColor).
-                                l1 at:idx2 put:(Text string:(l1 at:idx2) asString foregroundColor:changedSpacesOnlyColor backgroundColor:changedSpacesOnlyBgColor).
+                                line2 := Text string:(text2 at:idx2) 
+                                            foregroundColor:changedSpacesOnlyColor 
+                                            backgroundColor:changedSpacesOnlyBgColor.
+                                line1 := Text string:line1 asString 
+                                            foregroundColor:changedSpacesOnlyColor 
+                                            backgroundColor:changedSpacesOnlyBgColor.
+                                line1 string withoutSeparators = line2 string withoutSeparators ifTrue:[
+                                    line1 := line1 string.
+                                    line2 := line2 string.
+                                ].
+                                l2 add:line2.
+                                l1 at:idx2 put:line1.
                             ] ifFalse:[
-                                l2 add:(Text string:(text2 at:idx2) foregroundColor:changedColor backgroundColor:changedBgColor)
+                                line2 := Text string:(text2 at:idx2) foregroundColor:changedColor backgroundColor:changedBgColor.
+                                l2 add:line2
                             ]
                         ] ifFalse:[
                             l2 add:(text2 at:idx2).
@@ -465,7 +486,7 @@
                             dIdx := dIdx - 1
                         ]
                     ]
-                ]
+                ].
             ] ifFalse:[
                 state == #added ifTrue:[
                     (entry at:1) == $> ifTrue:[
@@ -510,10 +531,10 @@
     textView1 list:l1.
     textView2 list:l2
 
-    "Modified: / 5.5.1999 / 16:08:03 / cg"
+    "Modified: / 13.7.1999 / 14:12:11 / cg"
 ! !
 
 !DiffTextView class methodsFor:'documentation'!
 
 version
-^ '$Header: /cvs/stx/stx/libtool/Attic/DiffTxtV.st,v 1.25 1999-07-09 14:56:18 cg Exp $'! !
+^ '$Header: /cvs/stx/stx/libtool/Attic/DiffTxtV.st,v 1.26 1999-07-13 12:15:05 cg Exp $'! !