DiffTextView.st
author Claus Gittinger <cg@exept.de>
Mon, 20 Nov 2006 13:18:15 +0100
changeset 7526 616823c6a3da
parent 7177 92e1bdd56342
child 7602 cf179604a91b
permissions -rw-r--r--
care for 16bit string which isn't
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
36
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
     1
"
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
     2
 COPYRIGHT (c) 1994 by Claus Gittinger
45
950b84ba89e6 *** empty log message ***
claus
parents: 36
diff changeset
     3
	      All Rights Reserved
36
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
     4
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
     5
 This software is furnished under a license and may be used
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
     6
 only in accordance with the terms of that license and with the
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
     8
 be provided or otherwise made available to, or used by, any
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
     9
 other person.  No title to or ownership of the software is
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
    10
 hereby transferred.
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
    11
"
2716
8451e7057f00 some common startup protocol between DiffViewer and VersionDiffBrowser
Claus Gittinger <cg@exept.de>
parents: 2268
diff changeset
    12
"{ Package: 'stx:libtool' }"
8451e7057f00 some common startup protocol between DiffViewer and VersionDiffBrowser
Claus Gittinger <cg@exept.de>
parents: 2268
diff changeset
    13
36
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
    14
TwoColumnTextView subclass:#DiffTextView
313
c143d37be2e9 lines which differ only in blanks (indent) are shown light-blue
Claus Gittinger <cg@exept.de>
parents: 242
diff changeset
    15
	instanceVariableNames:'useColors showSeparators addedColor addedBgColor removedColor
c143d37be2e9 lines which differ only in blanks (indent) are shown light-blue
Claus Gittinger <cg@exept.de>
parents: 242
diff changeset
    16
		removedBgColor changedColor changedBgColor changedSpacesOnlyColor
507
90ed76da5ade commentary
Claus Gittinger <cg@exept.de>
parents: 318
diff changeset
    17
		changedSpacesOnlyBgColor diffLineNumbers'
1440
6a68adba9c33 allow configuration of diff command;
Claus Gittinger <cg@exept.de>
parents: 1276
diff changeset
    18
	classVariableNames:'DiffCommandTemplate'
313
c143d37be2e9 lines which differ only in blanks (indent) are shown light-blue
Claus Gittinger <cg@exept.de>
parents: 242
diff changeset
    19
	poolDictionaries:''
c143d37be2e9 lines which differ only in blanks (indent) are shown light-blue
Claus Gittinger <cg@exept.de>
parents: 242
diff changeset
    20
	category:'Views-Text'
36
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
    21
!
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
    22
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
    23
!DiffTextView class methodsFor:'documentation'!
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
    24
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
    25
copyright
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
    26
"
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
    27
 COPYRIGHT (c) 1994 by Claus Gittinger
45
950b84ba89e6 *** empty log message ***
claus
parents: 36
diff changeset
    28
	      All Rights Reserved
36
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
    29
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
    30
 This software is furnished under a license and may be used
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
    31
 only in accordance with the terms of that license and with the
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
    32
 inclusion of the above copyright notice.   This software may not
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
    33
 be provided or otherwise made available to, or used by, any
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
    34
 other person.  No title to or ownership of the software is
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
    35
 hereby transferred.
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
    36
"
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
    37
!
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
    38
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
    39
documentation
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
    40
"
507
90ed76da5ade commentary
Claus Gittinger <cg@exept.de>
parents: 318
diff changeset
    41
    a view showing diff output (see unix manual pages)
90ed76da5ade commentary
Claus Gittinger <cg@exept.de>
parents: 318
diff changeset
    42
    in a user-friendly form.
36
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
    43
    The view is created and opened with:
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
    44
507
90ed76da5ade commentary
Claus Gittinger <cg@exept.de>
parents: 318
diff changeset
    45
        d := DiffTextView openOn:text1 and:text2
90ed76da5ade commentary
Claus Gittinger <cg@exept.de>
parents: 318
diff changeset
    46
90ed76da5ade commentary
Claus Gittinger <cg@exept.de>
parents: 318
diff changeset
    47
    or:
90ed76da5ade commentary
Claus Gittinger <cg@exept.de>
parents: 318
diff changeset
    48
        d := DiffTextView openOn:text1 label:l1
90ed76da5ade commentary
Claus Gittinger <cg@exept.de>
parents: 318
diff changeset
    49
                             and:text2 label:l2
36
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
    50
507
90ed76da5ade commentary
Claus Gittinger <cg@exept.de>
parents: 318
diff changeset
    51
    and it will show the differences side-by-side.
533
5bf1a4a2adad checkin from browser
Claus Gittinger <cg@exept.de>
parents: 519
diff changeset
    52
2240
eb2688b9cf45 exchanged red/green colors.
Claus Gittinger <cg@exept.de>
parents: 2141
diff changeset
    53
    The colors mean:
eb2688b9cf45 exchanged red/green colors.
Claus Gittinger <cg@exept.de>
parents: 2141
diff changeset
    54
        red             - removed
eb2688b9cf45 exchanged red/green colors.
Claus Gittinger <cg@exept.de>
parents: 2141
diff changeset
    55
        green           - added
eb2688b9cf45 exchanged red/green colors.
Claus Gittinger <cg@exept.de>
parents: 2141
diff changeset
    56
        blue            - changed
eb2688b9cf45 exchanged red/green colors.
Claus Gittinger <cg@exept.de>
parents: 2141
diff changeset
    57
        light-blue        changed, but not really (i.e. spaces only)
eb2688b9cf45 exchanged red/green colors.
Claus Gittinger <cg@exept.de>
parents: 2141
diff changeset
    58
eb2688b9cf45 exchanged red/green colors.
Claus Gittinger <cg@exept.de>
parents: 2141
diff changeset
    59
    For a real world application and use of this widget, 
eb2688b9cf45 exchanged red/green colors.
Claus Gittinger <cg@exept.de>
parents: 2141
diff changeset
    60
    see the ChangesBrowsers `compare', 
eb2688b9cf45 exchanged red/green colors.
Claus Gittinger <cg@exept.de>
parents: 2141
diff changeset
    61
    or the browsers 'compare with repository' functions.
507
90ed76da5ade commentary
Claus Gittinger <cg@exept.de>
parents: 318
diff changeset
    62
2246
34262ef77055 comment; look if diff is present and handle the bad case gracious (win32)
Claus Gittinger <cg@exept.de>
parents: 2240
diff changeset
    63
    Notice:
34262ef77055 comment; look if diff is present and handle the bad case gracious (win32)
Claus Gittinger <cg@exept.de>
parents: 2240
diff changeset
    64
        A diff command must be available on your system and found
34262ef77055 comment; look if diff is present and handle the bad case gracious (win32)
Claus Gittinger <cg@exept.de>
parents: 2240
diff changeset
    65
        along the PATH (you will see a warning on stderr, if there is no diff).
34262ef77055 comment; look if diff is present and handle the bad case gracious (win32)
Claus Gittinger <cg@exept.de>
parents: 2240
diff changeset
    66
        We use gnu-diff.
34262ef77055 comment; look if diff is present and handle the bad case gracious (win32)
Claus Gittinger <cg@exept.de>
parents: 2240
diff changeset
    67
507
90ed76da5ade commentary
Claus Gittinger <cg@exept.de>
parents: 318
diff changeset
    68
    [see also:]
1276
66761d461a39 added example
Claus Gittinger <cg@exept.de>
parents: 623
diff changeset
    69
        TextView EditTextView Diff3TextView
519
95f7a0a41c05 documentation
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
    70
95f7a0a41c05 documentation
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
    71
    [author:]
95f7a0a41c05 documentation
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
    72
        Claus Gittinger
36
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
    73
"
1276
66761d461a39 added example
Claus Gittinger <cg@exept.de>
parents: 623
diff changeset
    74
!
66761d461a39 added example
Claus Gittinger <cg@exept.de>
parents: 623
diff changeset
    75
66761d461a39 added example
Claus Gittinger <cg@exept.de>
parents: 623
diff changeset
    76
examples
66761d461a39 added example
Claus Gittinger <cg@exept.de>
parents: 623
diff changeset
    77
"
66761d461a39 added example
Claus Gittinger <cg@exept.de>
parents: 623
diff changeset
    78
                                                        [exBegin]
66761d461a39 added example
Claus Gittinger <cg@exept.de>
parents: 623
diff changeset
    79
    |text1 text2|
66761d461a39 added example
Claus Gittinger <cg@exept.de>
parents: 623
diff changeset
    80
66761d461a39 added example
Claus Gittinger <cg@exept.de>
parents: 623
diff changeset
    81
    text1 := 'hello world
66761d461a39 added example
Claus Gittinger <cg@exept.de>
parents: 623
diff changeset
    82
here is some difference
66761d461a39 added example
Claus Gittinger <cg@exept.de>
parents: 623
diff changeset
    83
more text
66761d461a39 added example
Claus Gittinger <cg@exept.de>
parents: 623
diff changeset
    84
this line has been removed
66761d461a39 added example
Claus Gittinger <cg@exept.de>
parents: 623
diff changeset
    85
more text
66761d461a39 added example
Claus Gittinger <cg@exept.de>
parents: 623
diff changeset
    86
more text
66761d461a39 added example
Claus Gittinger <cg@exept.de>
parents: 623
diff changeset
    87
'.
66761d461a39 added example
Claus Gittinger <cg@exept.de>
parents: 623
diff changeset
    88
66761d461a39 added example
Claus Gittinger <cg@exept.de>
parents: 623
diff changeset
    89
    text2 := 'hello world
66761d461a39 added example
Claus Gittinger <cg@exept.de>
parents: 623
diff changeset
    90
where is the difference ?
66761d461a39 added example
Claus Gittinger <cg@exept.de>
parents: 623
diff changeset
    91
more text
66761d461a39 added example
Claus Gittinger <cg@exept.de>
parents: 623
diff changeset
    92
more text
66761d461a39 added example
Claus Gittinger <cg@exept.de>
parents: 623
diff changeset
    93
more text
66761d461a39 added example
Claus Gittinger <cg@exept.de>
parents: 623
diff changeset
    94
this line has been added
66761d461a39 added example
Claus Gittinger <cg@exept.de>
parents: 623
diff changeset
    95
'.
66761d461a39 added example
Claus Gittinger <cg@exept.de>
parents: 623
diff changeset
    96
66761d461a39 added example
Claus Gittinger <cg@exept.de>
parents: 623
diff changeset
    97
    DiffTextView openOn:text1 label:'text1'
66761d461a39 added example
Claus Gittinger <cg@exept.de>
parents: 623
diff changeset
    98
                    and:text2 label:'text2'
66761d461a39 added example
Claus Gittinger <cg@exept.de>
parents: 623
diff changeset
    99
                                                        [exEnd]
66761d461a39 added example
Claus Gittinger <cg@exept.de>
parents: 623
diff changeset
   100
"
242
85bf88a27903 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   101
! !
36
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
   102
2716
8451e7057f00 some common startup protocol between DiffViewer and VersionDiffBrowser
Claus Gittinger <cg@exept.de>
parents: 2268
diff changeset
   103
!DiffTextView class methodsFor:'instance creation'!
8451e7057f00 some common startup protocol between DiffViewer and VersionDiffBrowser
Claus Gittinger <cg@exept.de>
parents: 2268
diff changeset
   104
2948
cf5b7f232536 VersionDIffBrowser compatibility
Claus Gittinger <cg@exept.de>
parents: 2848
diff changeset
   105
openOnClass:classA labelA:lblA andClass:classB labelB:lblB title:title ifSame:sameAction
cf5b7f232536 VersionDIffBrowser compatibility
Claus Gittinger <cg@exept.de>
parents: 2848
diff changeset
   106
    "provided for protocol compatibility with the VersionDiffBrowser;
cf5b7f232536 VersionDIffBrowser compatibility
Claus Gittinger <cg@exept.de>
parents: 2848
diff changeset
   107
     actually, the classes are ignored here"
cf5b7f232536 VersionDIffBrowser compatibility
Claus Gittinger <cg@exept.de>
parents: 2848
diff changeset
   108
cf5b7f232536 VersionDIffBrowser compatibility
Claus Gittinger <cg@exept.de>
parents: 2848
diff changeset
   109
    |v aStream sourceA sourceB|
cf5b7f232536 VersionDIffBrowser compatibility
Claus Gittinger <cg@exept.de>
parents: 2848
diff changeset
   110
cf5b7f232536 VersionDIffBrowser compatibility
Claus Gittinger <cg@exept.de>
parents: 2848
diff changeset
   111
    aStream := '' writeStream.
cf5b7f232536 VersionDIffBrowser compatibility
Claus Gittinger <cg@exept.de>
parents: 2848
diff changeset
   112
    Method flushSourceStreamCache.
cf5b7f232536 VersionDIffBrowser compatibility
Claus Gittinger <cg@exept.de>
parents: 2848
diff changeset
   113
    classA fileOutOn:aStream withTimeStamp:false.
cf5b7f232536 VersionDIffBrowser compatibility
Claus Gittinger <cg@exept.de>
parents: 2848
diff changeset
   114
    sourceA := aStream contents asString.
cf5b7f232536 VersionDIffBrowser compatibility
Claus Gittinger <cg@exept.de>
parents: 2848
diff changeset
   115
cf5b7f232536 VersionDIffBrowser compatibility
Claus Gittinger <cg@exept.de>
parents: 2848
diff changeset
   116
    aStream := '' writeStream.
cf5b7f232536 VersionDIffBrowser compatibility
Claus Gittinger <cg@exept.de>
parents: 2848
diff changeset
   117
    Method flushSourceStreamCache.
cf5b7f232536 VersionDIffBrowser compatibility
Claus Gittinger <cg@exept.de>
parents: 2848
diff changeset
   118
    classB fileOutOn:aStream withTimeStamp:false.
cf5b7f232536 VersionDIffBrowser compatibility
Claus Gittinger <cg@exept.de>
parents: 2848
diff changeset
   119
    sourceB := aStream contents asString.
cf5b7f232536 VersionDIffBrowser compatibility
Claus Gittinger <cg@exept.de>
parents: 2848
diff changeset
   120
cf5b7f232536 VersionDIffBrowser compatibility
Claus Gittinger <cg@exept.de>
parents: 2848
diff changeset
   121
    v := self 
3755
603db82a35b2 code formatted only
Claus Gittinger <cg@exept.de>
parents: 3678
diff changeset
   122
            openOn:sourceA label:lblA
603db82a35b2 code formatted only
Claus Gittinger <cg@exept.de>
parents: 3678
diff changeset
   123
            and:sourceB label:lblB.      
2948
cf5b7f232536 VersionDIffBrowser compatibility
Claus Gittinger <cg@exept.de>
parents: 2848
diff changeset
   124
    v label:title.
cf5b7f232536 VersionDIffBrowser compatibility
Claus Gittinger <cg@exept.de>
parents: 2848
diff changeset
   125
    ^ v
cf5b7f232536 VersionDIffBrowser compatibility
Claus Gittinger <cg@exept.de>
parents: 2848
diff changeset
   126
!
cf5b7f232536 VersionDIffBrowser compatibility
Claus Gittinger <cg@exept.de>
parents: 2848
diff changeset
   127
2716
8451e7057f00 some common startup protocol between DiffViewer and VersionDiffBrowser
Claus Gittinger <cg@exept.de>
parents: 2268
diff changeset
   128
openOnClass:someClass labelA:lblA sourceA:sourceA labelB:lblB sourceB:sourceB
8451e7057f00 some common startup protocol between DiffViewer and VersionDiffBrowser
Claus Gittinger <cg@exept.de>
parents: 2268
diff changeset
   129
    "provided for protocol compatibility with the VersionDiffBrowser;
8451e7057f00 some common startup protocol between DiffViewer and VersionDiffBrowser
Claus Gittinger <cg@exept.de>
parents: 2268
diff changeset
   130
     actually, the class is ignored here"
8451e7057f00 some common startup protocol between DiffViewer and VersionDiffBrowser
Claus Gittinger <cg@exept.de>
parents: 2268
diff changeset
   131
3755
603db82a35b2 code formatted only
Claus Gittinger <cg@exept.de>
parents: 3678
diff changeset
   132
    ^ self 
603db82a35b2 code formatted only
Claus Gittinger <cg@exept.de>
parents: 3678
diff changeset
   133
        openOnClass:someClass 
603db82a35b2 code formatted only
Claus Gittinger <cg@exept.de>
parents: 3678
diff changeset
   134
        labelA:lblA sourceA:sourceA 
603db82a35b2 code formatted only
Claus Gittinger <cg@exept.de>
parents: 3678
diff changeset
   135
        labelB:lblB sourceB:sourceB 
603db82a35b2 code formatted only
Claus Gittinger <cg@exept.de>
parents: 3678
diff changeset
   136
        title:'Comparing ' , someClass name.
2716
8451e7057f00 some common startup protocol between DiffViewer and VersionDiffBrowser
Claus Gittinger <cg@exept.de>
parents: 2268
diff changeset
   137
!
8451e7057f00 some common startup protocol between DiffViewer and VersionDiffBrowser
Claus Gittinger <cg@exept.de>
parents: 2268
diff changeset
   138
8451e7057f00 some common startup protocol between DiffViewer and VersionDiffBrowser
Claus Gittinger <cg@exept.de>
parents: 2268
diff changeset
   139
openOnClass:someClass labelA:lblA sourceA:sourceA labelB:lblB sourceB:sourceB title:title
8451e7057f00 some common startup protocol between DiffViewer and VersionDiffBrowser
Claus Gittinger <cg@exept.de>
parents: 2268
diff changeset
   140
    "provided for protocol compatibility with the VersionDiffBrowser;
8451e7057f00 some common startup protocol between DiffViewer and VersionDiffBrowser
Claus Gittinger <cg@exept.de>
parents: 2268
diff changeset
   141
     actually, the class is ignored here"
8451e7057f00 some common startup protocol between DiffViewer and VersionDiffBrowser
Claus Gittinger <cg@exept.de>
parents: 2268
diff changeset
   142
2848
1b7a2ff36ccc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2750
diff changeset
   143
    ^ self
3755
603db82a35b2 code formatted only
Claus Gittinger <cg@exept.de>
parents: 3678
diff changeset
   144
        openOnClass:someClass 
603db82a35b2 code formatted only
Claus Gittinger <cg@exept.de>
parents: 3678
diff changeset
   145
        labelA:lblA sourceA:sourceA 
603db82a35b2 code formatted only
Claus Gittinger <cg@exept.de>
parents: 3678
diff changeset
   146
        labelB:lblB sourceB:sourceB 
603db82a35b2 code formatted only
Claus Gittinger <cg@exept.de>
parents: 3678
diff changeset
   147
        title:title ifSame:nil
2848
1b7a2ff36ccc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2750
diff changeset
   148
!
1b7a2ff36ccc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2750
diff changeset
   149
1b7a2ff36ccc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2750
diff changeset
   150
openOnClass:someClass labelA:lblA sourceA:sourceA labelB:lblB sourceB:sourceB title:title ifSame:sameAction
1b7a2ff36ccc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2750
diff changeset
   151
    "provided for protocol compatibility with the VersionDiffBrowser;
1b7a2ff36ccc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2750
diff changeset
   152
     actually, the class is ignored here"
1b7a2ff36ccc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2750
diff changeset
   153
2716
8451e7057f00 some common startup protocol between DiffViewer and VersionDiffBrowser
Claus Gittinger <cg@exept.de>
parents: 2268
diff changeset
   154
    |v|
8451e7057f00 some common startup protocol between DiffViewer and VersionDiffBrowser
Claus Gittinger <cg@exept.de>
parents: 2268
diff changeset
   155
2750
eed89615e816 startup bug fix
Claus Gittinger <cg@exept.de>
parents: 2716
diff changeset
   156
    v := self 
3755
603db82a35b2 code formatted only
Claus Gittinger <cg@exept.de>
parents: 3678
diff changeset
   157
            openOn:sourceA label:lblA
603db82a35b2 code formatted only
Claus Gittinger <cg@exept.de>
parents: 3678
diff changeset
   158
            and:sourceB label:lblB.      
3050
56e5cc9afece *** empty log message ***
penk
parents: 2948
diff changeset
   159
    v topView label:title.
2716
8451e7057f00 some common startup protocol between DiffViewer and VersionDiffBrowser
Claus Gittinger <cg@exept.de>
parents: 2268
diff changeset
   160
    ^ v
8451e7057f00 some common startup protocol between DiffViewer and VersionDiffBrowser
Claus Gittinger <cg@exept.de>
parents: 2268
diff changeset
   161
! !
8451e7057f00 some common startup protocol between DiffViewer and VersionDiffBrowser
Claus Gittinger <cg@exept.de>
parents: 2268
diff changeset
   162
45
950b84ba89e6 *** empty log message ***
claus
parents: 36
diff changeset
   163
!DiffTextView class methodsFor:'defaults'!
950b84ba89e6 *** empty log message ***
claus
parents: 36
diff changeset
   164
950b84ba89e6 *** empty log message ***
claus
parents: 36
diff changeset
   165
diffCommand
1440
6a68adba9c33 allow configuration of diff command;
Claus Gittinger <cg@exept.de>
parents: 1276
diff changeset
   166
    "return the diff-command (with argument placeHolders)"
6a68adba9c33 allow configuration of diff command;
Claus Gittinger <cg@exept.de>
parents: 1276
diff changeset
   167
2246
34262ef77055 comment; look if diff is present and handle the bad case gracious (win32)
Claus Gittinger <cg@exept.de>
parents: 2240
diff changeset
   168
    DiffCommandTemplate isNil ifTrue:[
34262ef77055 comment; look if diff is present and handle the bad case gracious (win32)
Claus Gittinger <cg@exept.de>
parents: 2240
diff changeset
   169
        OperatingSystem isMSDOSlike ifTrue:[
34262ef77055 comment; look if diff is present and handle the bad case gracious (win32)
Claus Gittinger <cg@exept.de>
parents: 2240
diff changeset
   170
            (OperatingSystem canExecuteCommand:'diff') ifFalse:[
6397
da138bd530d4 errorPrint -> infoPrint
ca
parents: 6231
diff changeset
   171
                'DiffTextView [warning]: no diff command found (please download and unzip "UnxUtils.zip" from "unxutils.sourceforge.net")' infoPrintCR.
2246
34262ef77055 comment; look if diff is present and handle the bad case gracious (win32)
Claus Gittinger <cg@exept.de>
parents: 2240
diff changeset
   172
                ^ nil
34262ef77055 comment; look if diff is present and handle the bad case gracious (win32)
Claus Gittinger <cg@exept.de>
parents: 2240
diff changeset
   173
            ].
6231
8382fe8c0e1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6047
diff changeset
   174
            ^ 'diff %1 %2'
8382fe8c0e1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6047
diff changeset
   175
        ].
8382fe8c0e1e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6047
diff changeset
   176
        ^ 'diff -b %1 %2'
1440
6a68adba9c33 allow configuration of diff command;
Claus Gittinger <cg@exept.de>
parents: 1276
diff changeset
   177
    ].
2246
34262ef77055 comment; look if diff is present and handle the bad case gracious (win32)
Claus Gittinger <cg@exept.de>
parents: 2240
diff changeset
   178
    ^ DiffCommandTemplate
1440
6a68adba9c33 allow configuration of diff command;
Claus Gittinger <cg@exept.de>
parents: 1276
diff changeset
   179
6a68adba9c33 allow configuration of diff command;
Claus Gittinger <cg@exept.de>
parents: 1276
diff changeset
   180
    "Modified: / 30.1.1998 / 12:12:49 / cg"
6a68adba9c33 allow configuration of diff command;
Claus Gittinger <cg@exept.de>
parents: 1276
diff changeset
   181
!
507
90ed76da5ade commentary
Claus Gittinger <cg@exept.de>
parents: 318
diff changeset
   182
1440
6a68adba9c33 allow configuration of diff command;
Claus Gittinger <cg@exept.de>
parents: 1276
diff changeset
   183
diffCommandTemplate:aCommandTemplateString
6a68adba9c33 allow configuration of diff command;
Claus Gittinger <cg@exept.de>
parents: 1276
diff changeset
   184
    "set the diff-command template"
6a68adba9c33 allow configuration of diff command;
Claus Gittinger <cg@exept.de>
parents: 1276
diff changeset
   185
6a68adba9c33 allow configuration of diff command;
Claus Gittinger <cg@exept.de>
parents: 1276
diff changeset
   186
    OperatingSystem isMSDOSlike ifTrue:[
6a68adba9c33 allow configuration of diff command;
Claus Gittinger <cg@exept.de>
parents: 1276
diff changeset
   187
        ^ DiffCommandTemplate ? 'diff %1 %2'
6a68adba9c33 allow configuration of diff command;
Claus Gittinger <cg@exept.de>
parents: 1276
diff changeset
   188
    ].
6a68adba9c33 allow configuration of diff command;
Claus Gittinger <cg@exept.de>
parents: 1276
diff changeset
   189
6a68adba9c33 allow configuration of diff command;
Claus Gittinger <cg@exept.de>
parents: 1276
diff changeset
   190
    ^ DiffCommandTemplate ? 'diff -b %1 %2'
6a68adba9c33 allow configuration of diff command;
Claus Gittinger <cg@exept.de>
parents: 1276
diff changeset
   191
6a68adba9c33 allow configuration of diff command;
Claus Gittinger <cg@exept.de>
parents: 1276
diff changeset
   192
    "Modified: / 30.1.1998 / 12:10:34 / cg"
6a68adba9c33 allow configuration of diff command;
Claus Gittinger <cg@exept.de>
parents: 1276
diff changeset
   193
    "Created: / 30.1.1998 / 12:12:37 / cg"
45
950b84ba89e6 *** empty log message ***
claus
parents: 36
diff changeset
   194
! !
950b84ba89e6 *** empty log message ***
claus
parents: 36
diff changeset
   195
36
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
   196
!DiffTextView methodsFor:'accessing'!
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
   197
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
   198
text1:t1 text2:t2
1440
6a68adba9c33 allow configuration of diff command;
Claus Gittinger <cg@exept.de>
parents: 1276
diff changeset
   199
    "set the two texts which are to be diffed;
6a68adba9c33 allow configuration of diff command;
Claus Gittinger <cg@exept.de>
parents: 1276
diff changeset
   200
     execute DiffCommand and update the two textViews."
507
90ed76da5ade commentary
Claus Gittinger <cg@exept.de>
parents: 318
diff changeset
   201
6577
51b89422d7de be more robust w.r.t. errors while diffing
Claus Gittinger <cg@exept.de>
parents: 6413
diff changeset
   202
    |text1 text2 diffList|
36
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
   203
69
0d6acfdae045 *** empty log message ***
claus
parents: 52
diff changeset
   204
    text1 := t1 asStringCollection.
0d6acfdae045 *** empty log message ***
claus
parents: 52
diff changeset
   205
    text2 := t2 asStringCollection.
36
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
   206
7177
92e1bdd56342 oops - care for CRLF (msdos)
ca
parents: 6649
diff changeset
   207
"/    Error catch:[
6577
51b89422d7de be more robust w.r.t. errors while diffing
Claus Gittinger <cg@exept.de>
parents: 6413
diff changeset
   208
        diffList := self diffListFor:text1 and:text2.
7177
92e1bdd56342 oops - care for CRLF (msdos)
ca
parents: 6649
diff changeset
   209
"/    ].
36
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
   210
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
   211
    self updateListsFrom:text1 and:text2 diffs:diffList
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
   212
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
   213
    "
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
   214
     |v|
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
   215
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
   216
     v := HVScrollableView for:DiffTextView.
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
   217
     v scrolledView text1:('../libview/Color.st' asFilename readStream contents)
507
90ed76da5ade commentary
Claus Gittinger <cg@exept.de>
parents: 318
diff changeset
   218
                    text2:('../libview/Color.st.old' asFilename readStream contents).
36
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
   219
     v open
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
   220
    "
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
   221
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
   222
    "
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
   223
     |v t1 t2|
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
   224
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
   225
     t1 := '
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
   226
one
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
   227
two
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
   228
three
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
   229
four
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
   230
'.
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
   231
     t2 := '
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
   232
one
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
   233
two-a
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
   234
two-b
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
   235
three
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
   236
three-b
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
   237
four
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
   238
'.
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
   239
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
   240
     v := DiffTextView new.
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
   241
     v text1:t1 text2:t2.
69
0d6acfdae045 *** empty log message ***
claus
parents: 52
diff changeset
   242
     v open
36
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
   243
    "
507
90ed76da5ade commentary
Claus Gittinger <cg@exept.de>
parents: 318
diff changeset
   244
2141
1758f387ebe7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1440
diff changeset
   245
    "Modified: / 5.5.1999 / 16:07:13 / cg"
36
ccde5a941840 *** empty log message ***
claus
parents:
diff changeset
   246
! !
183
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   247
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   248
!DiffTextView methodsFor:'initialization'!
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   249
2246
34262ef77055 comment; look if diff is present and handle the bad case gracious (win32)
Claus Gittinger <cg@exept.de>
parents: 2240
diff changeset
   250
addNextPreviousButtons
34262ef77055 comment; look if diff is present and handle the bad case gracious (win32)
Claus Gittinger <cg@exept.de>
parents: 2240
diff changeset
   251
    super addNextPreviousButtons.
34262ef77055 comment; look if diff is present and handle the bad case gracious (win32)
Claus Gittinger <cg@exept.de>
parents: 2240
diff changeset
   252
    nextPrevButtonPanel beVisible.
34262ef77055 comment; look if diff is present and handle the bad case gracious (win32)
Claus Gittinger <cg@exept.de>
parents: 2240
diff changeset
   253
!
34262ef77055 comment; look if diff is present and handle the bad case gracious (win32)
Claus Gittinger <cg@exept.de>
parents: 2240
diff changeset
   254
183
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   255
initStyle
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   256
    super initStyle.
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   257
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   258
    showSeparators := false.
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   259
544
dea45065e7f1 use Text instead of ColoredListEntry
Claus Gittinger <cg@exept.de>
parents: 533
diff changeset
   260
    (useColors := device hasColors) ifTrue:[
2240
eb2688b9cf45 exchanged red/green colors.
Claus Gittinger <cg@exept.de>
parents: 2141
diff changeset
   261
        addedColor := Color white.
eb2688b9cf45 exchanged red/green colors.
Claus Gittinger <cg@exept.de>
parents: 2141
diff changeset
   262
        addedBgColor := Color red.
183
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   263
2240
eb2688b9cf45 exchanged red/green colors.
Claus Gittinger <cg@exept.de>
parents: 2141
diff changeset
   264
        removedColor := Color black.
eb2688b9cf45 exchanged red/green colors.
Claus Gittinger <cg@exept.de>
parents: 2141
diff changeset
   265
        removedBgColor := Color green.
183
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   266
544
dea45065e7f1 use Text instead of ColoredListEntry
Claus Gittinger <cg@exept.de>
parents: 533
diff changeset
   267
        changedColor := Color white.
dea45065e7f1 use Text instead of ColoredListEntry
Claus Gittinger <cg@exept.de>
parents: 533
diff changeset
   268
        changedBgColor := Color blue.
313
c143d37be2e9 lines which differ only in blanks (indent) are shown light-blue
Claus Gittinger <cg@exept.de>
parents: 242
diff changeset
   269
544
dea45065e7f1 use Text instead of ColoredListEntry
Claus Gittinger <cg@exept.de>
parents: 533
diff changeset
   270
        changedSpacesOnlyColor := Color white.
dea45065e7f1 use Text instead of ColoredListEntry
Claus Gittinger <cg@exept.de>
parents: 533
diff changeset
   271
        changedSpacesOnlyBgColor := Color blue lightened.
dea45065e7f1 use Text instead of ColoredListEntry
Claus Gittinger <cg@exept.de>
parents: 533
diff changeset
   272
    ] ifFalse:[
623
48cc09809032 fixed for greyscale displays
Claus Gittinger <cg@exept.de>
parents: 544
diff changeset
   273
        showSeparators := true.
48cc09809032 fixed for greyscale displays
Claus Gittinger <cg@exept.de>
parents: 544
diff changeset
   274
48cc09809032 fixed for greyscale displays
Claus Gittinger <cg@exept.de>
parents: 544
diff changeset
   275
        (useColors := device hasGreyscales) ifTrue:[
48cc09809032 fixed for greyscale displays
Claus Gittinger <cg@exept.de>
parents: 544
diff changeset
   276
            addedBgColor := removedBgColor := changedBgColor := Color grey:80.
48cc09809032 fixed for greyscale displays
Claus Gittinger <cg@exept.de>
parents: 544
diff changeset
   277
            addedColor := removedColor := changedColor := Color black.
48cc09809032 fixed for greyscale displays
Claus Gittinger <cg@exept.de>
parents: 544
diff changeset
   278
        ] ifFalse:[
48cc09809032 fixed for greyscale displays
Claus Gittinger <cg@exept.de>
parents: 544
diff changeset
   279
            addedBgColor := removedBgColor := changedBgColor := Color black.
48cc09809032 fixed for greyscale displays
Claus Gittinger <cg@exept.de>
parents: 544
diff changeset
   280
            addedColor := removedColor := changedColor := Color white.
48cc09809032 fixed for greyscale displays
Claus Gittinger <cg@exept.de>
parents: 544
diff changeset
   281
        ].
48cc09809032 fixed for greyscale displays
Claus Gittinger <cg@exept.de>
parents: 544
diff changeset
   282
48cc09809032 fixed for greyscale displays
Claus Gittinger <cg@exept.de>
parents: 544
diff changeset
   283
        changedSpacesOnlyColor := Color white.
48cc09809032 fixed for greyscale displays
Claus Gittinger <cg@exept.de>
parents: 544
diff changeset
   284
        changedSpacesOnlyBgColor := Color black.
183
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   285
    ].
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   286
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   287
    "Created: 16.11.1995 / 16:59:48 / cg"
623
48cc09809032 fixed for greyscale displays
Claus Gittinger <cg@exept.de>
parents: 544
diff changeset
   288
    "Modified: 14.6.1996 / 16:14:39 / cg"
183
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   289
! !
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   290
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   291
!DiffTextView methodsFor:'private'!
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   292
6577
51b89422d7de be more robust w.r.t. errors while diffing
Claus Gittinger <cg@exept.de>
parents: 6413
diff changeset
   293
diffListFor:text1 and:text2
51b89422d7de be more robust w.r.t. errors while diffing
Claus Gittinger <cg@exept.de>
parents: 6413
diff changeset
   294
    "set the two texts which are to be diffed;
51b89422d7de be more robust w.r.t. errors while diffing
Claus Gittinger <cg@exept.de>
parents: 6413
diff changeset
   295
     execute DiffCommand and update the two textViews."
51b89422d7de be more robust w.r.t. errors while diffing
Claus Gittinger <cg@exept.de>
parents: 6413
diff changeset
   296
51b89422d7de be more robust w.r.t. errors while diffing
Claus Gittinger <cg@exept.de>
parents: 6413
diff changeset
   297
    |tmpFile1 tmpFile2 stream line 
51b89422d7de be more robust w.r.t. errors while diffing
Claus Gittinger <cg@exept.de>
parents: 6413
diff changeset
   298
     diffList diffTemplate diffCmd|
51b89422d7de be more robust w.r.t. errors while diffing
Claus Gittinger <cg@exept.de>
parents: 6413
diff changeset
   299
51b89422d7de be more robust w.r.t. errors while diffing
Claus Gittinger <cg@exept.de>
parents: 6413
diff changeset
   300
    diffTemplate := self class diffCommand.
51b89422d7de be more robust w.r.t. errors while diffing
Claus Gittinger <cg@exept.de>
parents: 6413
diff changeset
   301
    diffTemplate isNil ifTrue:[
51b89422d7de be more robust w.r.t. errors while diffing
Claus Gittinger <cg@exept.de>
parents: 6413
diff changeset
   302
        "/ self warn:'no diff command available'.
51b89422d7de be more robust w.r.t. errors while diffing
Claus Gittinger <cg@exept.de>
parents: 6413
diff changeset
   303
        ^ nil
51b89422d7de be more robust w.r.t. errors while diffing
Claus Gittinger <cg@exept.de>
parents: 6413
diff changeset
   304
    ].
51b89422d7de be more robust w.r.t. errors while diffing
Claus Gittinger <cg@exept.de>
parents: 6413
diff changeset
   305
51b89422d7de be more robust w.r.t. errors while diffing
Claus Gittinger <cg@exept.de>
parents: 6413
diff changeset
   306
    "
51b89422d7de be more robust w.r.t. errors while diffing
Claus Gittinger <cg@exept.de>
parents: 6413
diff changeset
   307
     save them texts in two temporary files ...
51b89422d7de be more robust w.r.t. errors while diffing
Claus Gittinger <cg@exept.de>
parents: 6413
diff changeset
   308
    "
51b89422d7de be more robust w.r.t. errors while diffing
Claus Gittinger <cg@exept.de>
parents: 6413
diff changeset
   309
    self save:text1 as:(tmpFile1 := Filename newTemporary).
51b89422d7de be more robust w.r.t. errors while diffing
Claus Gittinger <cg@exept.de>
parents: 6413
diff changeset
   310
    self save:text2 as:(tmpFile2 := Filename newTemporary).
51b89422d7de be more robust w.r.t. errors while diffing
Claus Gittinger <cg@exept.de>
parents: 6413
diff changeset
   311
51b89422d7de be more robust w.r.t. errors while diffing
Claus Gittinger <cg@exept.de>
parents: 6413
diff changeset
   312
    "
51b89422d7de be more robust w.r.t. errors while diffing
Claus Gittinger <cg@exept.de>
parents: 6413
diff changeset
   313
     start diff on it ...
51b89422d7de be more robust w.r.t. errors while diffing
Claus Gittinger <cg@exept.de>
parents: 6413
diff changeset
   314
    "
51b89422d7de be more robust w.r.t. errors while diffing
Claus Gittinger <cg@exept.de>
parents: 6413
diff changeset
   315
    diffCmd := diffTemplate
51b89422d7de be more robust w.r.t. errors while diffing
Claus Gittinger <cg@exept.de>
parents: 6413
diff changeset
   316
                bindWith:tmpFile1 asString
51b89422d7de be more robust w.r.t. errors while diffing
Claus Gittinger <cg@exept.de>
parents: 6413
diff changeset
   317
                with:tmpFile2 asString.
51b89422d7de be more robust w.r.t. errors while diffing
Claus Gittinger <cg@exept.de>
parents: 6413
diff changeset
   318
51b89422d7de be more robust w.r.t. errors while diffing
Claus Gittinger <cg@exept.de>
parents: 6413
diff changeset
   319
    stream := PipeStream readingFrom:diffCmd.
51b89422d7de be more robust w.r.t. errors while diffing
Claus Gittinger <cg@exept.de>
parents: 6413
diff changeset
   320
    stream isNil ifTrue:[
51b89422d7de be more robust w.r.t. errors while diffing
Claus Gittinger <cg@exept.de>
parents: 6413
diff changeset
   321
        stream := PipeStream readingFrom:('support' , Filename separator , diffCmd).
51b89422d7de be more robust w.r.t. errors while diffing
Claus Gittinger <cg@exept.de>
parents: 6413
diff changeset
   322
    ].                                          
51b89422d7de be more robust w.r.t. errors while diffing
Claus Gittinger <cg@exept.de>
parents: 6413
diff changeset
   323
    stream isNil ifTrue:[
51b89422d7de be more robust w.r.t. errors while diffing
Claus Gittinger <cg@exept.de>
parents: 6413
diff changeset
   324
        tmpFile1 delete.
51b89422d7de be more robust w.r.t. errors while diffing
Claus Gittinger <cg@exept.de>
parents: 6413
diff changeset
   325
        tmpFile2 delete.
51b89422d7de be more robust w.r.t. errors while diffing
Claus Gittinger <cg@exept.de>
parents: 6413
diff changeset
   326
        self error:'cannot execute diff' mayProceed:true.
51b89422d7de be more robust w.r.t. errors while diffing
Claus Gittinger <cg@exept.de>
parents: 6413
diff changeset
   327
        ^ nil.
51b89422d7de be more robust w.r.t. errors while diffing
Claus Gittinger <cg@exept.de>
parents: 6413
diff changeset
   328
    ].
51b89422d7de be more robust w.r.t. errors while diffing
Claus Gittinger <cg@exept.de>
parents: 6413
diff changeset
   329
51b89422d7de be more robust w.r.t. errors while diffing
Claus Gittinger <cg@exept.de>
parents: 6413
diff changeset
   330
    diffList := OrderedCollection new.
51b89422d7de be more robust w.r.t. errors while diffing
Claus Gittinger <cg@exept.de>
parents: 6413
diff changeset
   331
    [stream atEnd] whileFalse:[
51b89422d7de be more robust w.r.t. errors while diffing
Claus Gittinger <cg@exept.de>
parents: 6413
diff changeset
   332
        line := stream nextLine.
51b89422d7de be more robust w.r.t. errors while diffing
Claus Gittinger <cg@exept.de>
parents: 6413
diff changeset
   333
        line notNil ifTrue:[diffList add:line]
51b89422d7de be more robust w.r.t. errors while diffing
Claus Gittinger <cg@exept.de>
parents: 6413
diff changeset
   334
    ].
51b89422d7de be more robust w.r.t. errors while diffing
Claus Gittinger <cg@exept.de>
parents: 6413
diff changeset
   335
    stream close.
51b89422d7de be more robust w.r.t. errors while diffing
Claus Gittinger <cg@exept.de>
parents: 6413
diff changeset
   336
51b89422d7de be more robust w.r.t. errors while diffing
Claus Gittinger <cg@exept.de>
parents: 6413
diff changeset
   337
    tmpFile1 delete.
51b89422d7de be more robust w.r.t. errors while diffing
Claus Gittinger <cg@exept.de>
parents: 6413
diff changeset
   338
    tmpFile2 delete.
51b89422d7de be more robust w.r.t. errors while diffing
Claus Gittinger <cg@exept.de>
parents: 6413
diff changeset
   339
51b89422d7de be more robust w.r.t. errors while diffing
Claus Gittinger <cg@exept.de>
parents: 6413
diff changeset
   340
    ^ diffList
51b89422d7de be more robust w.r.t. errors while diffing
Claus Gittinger <cg@exept.de>
parents: 6413
diff changeset
   341
!
51b89422d7de be more robust w.r.t. errors while diffing
Claus Gittinger <cg@exept.de>
parents: 6413
diff changeset
   342
51b89422d7de be more robust w.r.t. errors while diffing
Claus Gittinger <cg@exept.de>
parents: 6413
diff changeset
   343
save:text as:filename
51b89422d7de be more robust w.r.t. errors while diffing
Claus Gittinger <cg@exept.de>
parents: 6413
diff changeset
   344
    |stream|
51b89422d7de be more robust w.r.t. errors while diffing
Claus Gittinger <cg@exept.de>
parents: 6413
diff changeset
   345
51b89422d7de be more robust w.r.t. errors while diffing
Claus Gittinger <cg@exept.de>
parents: 6413
diff changeset
   346
    stream := filename writeStream.
51b89422d7de be more robust w.r.t. errors while diffing
Claus Gittinger <cg@exept.de>
parents: 6413
diff changeset
   347
    text do:[:line |
7177
92e1bdd56342 oops - care for CRLF (msdos)
ca
parents: 6649
diff changeset
   348
        |lOut|
92e1bdd56342 oops - care for CRLF (msdos)
ca
parents: 6649
diff changeset
   349
6577
51b89422d7de be more robust w.r.t. errors while diffing
Claus Gittinger <cg@exept.de>
parents: 6413
diff changeset
   350
        line notNil ifTrue:[
7177
92e1bdd56342 oops - care for CRLF (msdos)
ca
parents: 6649
diff changeset
   351
            lOut := line.
6577
51b89422d7de be more robust w.r.t. errors while diffing
Claus Gittinger <cg@exept.de>
parents: 6413
diff changeset
   352
            (line includes:Character return) ifTrue: [
7177
92e1bdd56342 oops - care for CRLF (msdos)
ca
parents: 6649
diff changeset
   353
                (line endsWith:Character return) ifTrue:[
92e1bdd56342 oops - care for CRLF (msdos)
ca
parents: 6649
diff changeset
   354
                    lOut := line copyWithoutLast:1.
92e1bdd56342 oops - care for CRLF (msdos)
ca
parents: 6649
diff changeset
   355
                ] ifFalse:[
92e1bdd56342 oops - care for CRLF (msdos)
ca
parents: 6649
diff changeset
   356
                    self error:'oops - funny line (includes returns) in text'.
92e1bdd56342 oops - care for CRLF (msdos)
ca
parents: 6649
diff changeset
   357
                ]
6577
51b89422d7de be more robust w.r.t. errors while diffing
Claus Gittinger <cg@exept.de>
parents: 6413
diff changeset
   358
            ].
7526
616823c6a3da care for 16bit string which isn't
Claus Gittinger <cg@exept.de>
parents: 7177
diff changeset
   359
            lOut bitsPerCharacter > 8 ifTrue:[
616823c6a3da care for 16bit string which isn't
Claus Gittinger <cg@exept.de>
parents: 7177
diff changeset
   360
                (lOut first = (Character value:16rFEFF)) ifTrue:[
616823c6a3da care for 16bit string which isn't
Claus Gittinger <cg@exept.de>
parents: 7177
diff changeset
   361
                    lOut := (lOut copyFrom:2) asSingleByteStringIfPossible.
616823c6a3da care for 16bit string which isn't
Claus Gittinger <cg@exept.de>
parents: 7177
diff changeset
   362
                ].
616823c6a3da care for 16bit string which isn't
Claus Gittinger <cg@exept.de>
parents: 7177
diff changeset
   363
            ].
7177
92e1bdd56342 oops - care for CRLF (msdos)
ca
parents: 6649
diff changeset
   364
            stream nextPutAll:lOut.
6577
51b89422d7de be more robust w.r.t. errors while diffing
Claus Gittinger <cg@exept.de>
parents: 6413
diff changeset
   365
        ].
51b89422d7de be more robust w.r.t. errors while diffing
Claus Gittinger <cg@exept.de>
parents: 6413
diff changeset
   366
        stream cr
51b89422d7de be more robust w.r.t. errors while diffing
Claus Gittinger <cg@exept.de>
parents: 6413
diff changeset
   367
    ].
51b89422d7de be more robust w.r.t. errors while diffing
Claus Gittinger <cg@exept.de>
parents: 6413
diff changeset
   368
    stream close.
7526
616823c6a3da care for 16bit string which isn't
Claus Gittinger <cg@exept.de>
parents: 7177
diff changeset
   369
616823c6a3da care for 16bit string which isn't
Claus Gittinger <cg@exept.de>
parents: 7177
diff changeset
   370
    "Modified: / 20-11-2006 / 13:12:12 / cg"
6577
51b89422d7de be more robust w.r.t. errors while diffing
Claus Gittinger <cg@exept.de>
parents: 6413
diff changeset
   371
!
51b89422d7de be more robust w.r.t. errors while diffing
Claus Gittinger <cg@exept.de>
parents: 6413
diff changeset
   372
183
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   373
updateListsFrom:text1 and:text2 diffs:diffList
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   374
    "given the two texts in text1 and text2, and the diff-output in diffList,
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   375
     update my views contents"
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   376
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   377
    |idx1 idx2 dIdx dEnd state s nr1 nr2 nr3 op entry c l1 l2 any delta
2260
2c093fe9ddb1 fix for win32 diff (which does not support -b option)
Claus Gittinger <cg@exept.de>
parents: 2246
diff changeset
   378
     textView1 textView2 s1 s2 line1 line2|
183
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   379
507
90ed76da5ade commentary
Claus Gittinger <cg@exept.de>
parents: 318
diff changeset
   380
    diffLineNumbers := OrderedCollection new.
90ed76da5ade commentary
Claus Gittinger <cg@exept.de>
parents: 318
diff changeset
   381
183
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   382
    textView1 := textViews at:1.
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   383
    textView2 := textViews at:2.
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   384
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   385
    l1 := OrderedCollection new.
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   386
    l2 := OrderedCollection new.
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   387
4413
ff365700effb care for binary files
Claus Gittinger <cg@exept.de>
parents: 3755
diff changeset
   388
    diffList size == 1 ifTrue:[
ff365700effb care for binary files
Claus Gittinger <cg@exept.de>
parents: 3755
diff changeset
   389
        textView1 list:diffList.
ff365700effb care for binary files
Claus Gittinger <cg@exept.de>
parents: 3755
diff changeset
   390
        textView2 list:diffList.
ff365700effb care for binary files
Claus Gittinger <cg@exept.de>
parents: 3755
diff changeset
   391
        ^ self.
ff365700effb care for binary files
Claus Gittinger <cg@exept.de>
parents: 3755
diff changeset
   392
    ].
ff365700effb care for binary files
Claus Gittinger <cg@exept.de>
parents: 3755
diff changeset
   393
183
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   394
    idx1 := 1.
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   395
    idx2 := 1.
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   396
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   397
    dIdx := 1.
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   398
    dEnd := diffList size + 1.
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   399
    state := #initial.
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   400
    [dIdx <= dEnd] whileTrue:[
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   401
        dIdx == dEnd ifTrue:[
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   402
            "dummy cleanup entry"
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   403
            entry := nil.
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   404
            state := #initial.
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   405
        ] ifFalse:[
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   406
            entry := diffList at:dIdx.
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   407
        ].
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   408
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   409
        state == #initial ifTrue:[
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   410
            "entry is of the form <nr> <op> <offs> [<offs2>]"
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   411
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   412
            "
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   413
             fill up to size difference from previous change
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   414
            "
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   415
            delta := l1 size - l2 size.
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   416
            delta > 0 ifTrue:[
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   417
                delta timesRepeat:[l2 add:nil]
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   418
            ] ifFalse:[
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   419
                delta < 0 ifTrue:[
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   420
                    delta negated timesRepeat:[l1 add:nil]
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   421
                ]
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   422
            ].
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   423
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   424
            "
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   425
             except for the first chunk, add a separating line
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   426
            "
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   427
            l1 size ~~ 0 ifTrue:[
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   428
                showSeparators ifTrue:[
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   429
                    l1 add:'--------'.
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   430
                    l2 add:'--------'.
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   431
                ]
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   432
            ].
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   433
            "
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   434
             in cleanup ?
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   435
            "
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   436
            entry isNil ifTrue:[
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   437
                nr1 := text1 size + 1.
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   438
                nr2 := text2 size + 1.
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   439
                state := #finish.
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   440
            ] ifFalse:[
507
90ed76da5ade commentary
Claus Gittinger <cg@exept.de>
parents: 318
diff changeset
   441
                diffLineNumbers add:l1 size.
90ed76da5ade commentary
Claus Gittinger <cg@exept.de>
parents: 318
diff changeset
   442
183
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   443
                s := ReadStream on:entry.
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   444
                nr1 := Integer readFrom:s.
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   445
                s peek == $, ifTrue:[
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   446
                    s next.
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   447
                    Integer readFrom:s
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   448
                ].
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   449
                op := s next.
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   450
                nr2 := Integer readFrom:s.
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   451
                s peek == $, ifTrue:[
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   452
                    s next.
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   453
                    nr3 := Integer readFrom:s
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   454
                ] ifFalse:[
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   455
                    nr3 := nil
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   456
                ].
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   457
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   458
                op == $c ifTrue:[
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   459
                    state := #changed.
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   460
                ] ifFalse:[
2246
34262ef77055 comment; look if diff is present and handle the bad case gracious (win32)
Claus Gittinger <cg@exept.de>
parents: 2240
diff changeset
   461
                    (op == $a) ifTrue:[
183
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   462
                        state := #added.
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   463
                    ] ifFalse:[
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   464
                        op == $d ifTrue:[
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   465
                            state := #deleted
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   466
                        ] ifFalse:[
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   467
                            self halt:'unexpected diff entry'.
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   468
                        ]
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   469
                    ]
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   470
                ].
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   471
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   472
            ].
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   473
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   474
"/ nr1 print. ' ' print. op print. ' ' print. nr2 print. ' , ' print. nr3 printNL.
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   475
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   476
            "
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   477
             copy over unchanged lines
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   478
            "
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   479
            any := false.
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   480
            [idx1 < nr1] whileTrue:[
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   481
"/ '< add:' print. idx1 printNL.
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   482
                l1 add:(text1 at:idx1).
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   483
                idx1 := idx1 + 1.
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   484
                any := true.
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   485
            ].
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   486
            [idx2 < nr2] whileTrue:[
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   487
"/ '> add:' print. idx2 printNL.
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   488
                l2 add:(text2 at:idx2).
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   489
                idx2 := idx2 + 1.
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   490
                any := true.
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   491
            ].
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   492
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   493
            state == #added ifTrue:[
4489
0deb97a82d68 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4413
diff changeset
   494
                l1 add:(text1 at:idx1 ifAbsent:'').
183
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   495
                idx1 := idx1 + 1.
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   496
            ].
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   497
            state == #deleted ifTrue:[
4489
0deb97a82d68 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4413
diff changeset
   498
                l2 add:(text2 at:idx2 ifAbsent:'').
183
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   499
                idx2 := idx2 + 1.
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   500
            ].
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   501
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   502
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   503
            "
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   504
             add a separating line, except at end
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   505
            "
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   506
            any ifTrue:[
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   507
                state ~~ #finish ifTrue:[
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   508
                    showSeparators ifTrue:[
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   509
                        l1 add:'--------'.
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   510
                        l2 add:'--------'.
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   511
                    ]
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   512
                ]
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   513
            ].
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   514
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   515
        ] ifFalse:[
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   516
            state == #changed ifTrue:[
2260
2c093fe9ddb1 fix for win32 diff (which does not support -b option)
Claus Gittinger <cg@exept.de>
parents: 2246
diff changeset
   517
                line1 := line2 := nil.
183
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   518
                (entry at:1) == $< ifTrue:[
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   519
                    useColors ifTrue:[
313
c143d37be2e9 lines which differ only in blanks (indent) are shown light-blue
Claus Gittinger <cg@exept.de>
parents: 242
diff changeset
   520
                        (l2 size >= idx1
2260
2c093fe9ddb1 fix for win32 diff (which does not support -b option)
Claus Gittinger <cg@exept.de>
parents: 2246
diff changeset
   521
                        and:[(s2 := line2 := l2 at:idx1) notNil
2141
1758f387ebe7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1440
diff changeset
   522
                        and:[(s2 asString withoutSeparators = (text1 at:idx1) withoutSeparators)
1758f387ebe7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1440
diff changeset
   523
                              "/ or:[(s2 asString withoutSeparators withTabsExpanded = (text1 at:idx1) withoutSeparators withTabsExpanded)]  
1758f387ebe7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1440
diff changeset
   524
                        ]]) ifTrue:[
2260
2c093fe9ddb1 fix for win32 diff (which does not support -b option)
Claus Gittinger <cg@exept.de>
parents: 2246
diff changeset
   525
                            line1 := Text string:(text1 at:idx1) 
544
dea45065e7f1 use Text instead of ColoredListEntry
Claus Gittinger <cg@exept.de>
parents: 533
diff changeset
   526
                                         foregroundColor:changedSpacesOnlyColor
2260
2c093fe9ddb1 fix for win32 diff (which does not support -b option)
Claus Gittinger <cg@exept.de>
parents: 2246
diff changeset
   527
                                         backgroundColor:changedSpacesOnlyBgColor.
2c093fe9ddb1 fix for win32 diff (which does not support -b option)
Claus Gittinger <cg@exept.de>
parents: 2246
diff changeset
   528
                            line2 := Text string:line2 asString 
2c093fe9ddb1 fix for win32 diff (which does not support -b option)
Claus Gittinger <cg@exept.de>
parents: 2246
diff changeset
   529
                                         foregroundColor:changedSpacesOnlyColor 
2c093fe9ddb1 fix for win32 diff (which does not support -b option)
Claus Gittinger <cg@exept.de>
parents: 2246
diff changeset
   530
                                         backgroundColor:changedSpacesOnlyBgColor.
2c093fe9ddb1 fix for win32 diff (which does not support -b option)
Claus Gittinger <cg@exept.de>
parents: 2246
diff changeset
   531
2262
75d490e87d95 oops - care for diff -b space differences
Claus Gittinger <cg@exept.de>
parents: 2260
diff changeset
   532
                            line1 string withoutTrailingSeparators = line2 string withoutTrailingSeparators ifTrue:[
2260
2c093fe9ddb1 fix for win32 diff (which does not support -b option)
Claus Gittinger <cg@exept.de>
parents: 2246
diff changeset
   533
                                line1 := line1 string.
2c093fe9ddb1 fix for win32 diff (which does not support -b option)
Claus Gittinger <cg@exept.de>
parents: 2246
diff changeset
   534
                                line2 := line2 string.
6413
ee2f36cef562 care for space vs. tab
Claus Gittinger <cg@exept.de>
parents: 6397
diff changeset
   535
                            ] ifFalse:[
ee2f36cef562 care for space vs. tab
Claus Gittinger <cg@exept.de>
parents: 6397
diff changeset
   536
                                line1 withoutSeparators withTabsExpanded = line2 withoutSeparators withTabsExpanded
ee2f36cef562 care for space vs. tab
Claus Gittinger <cg@exept.de>
parents: 6397
diff changeset
   537
                                ifTrue:[
ee2f36cef562 care for space vs. tab
Claus Gittinger <cg@exept.de>
parents: 6397
diff changeset
   538
                                    line1 := line1 string.
ee2f36cef562 care for space vs. tab
Claus Gittinger <cg@exept.de>
parents: 6397
diff changeset
   539
                                    line2 := line2 string.
ee2f36cef562 care for space vs. tab
Claus Gittinger <cg@exept.de>
parents: 6397
diff changeset
   540
                                ]
2260
2c093fe9ddb1 fix for win32 diff (which does not support -b option)
Claus Gittinger <cg@exept.de>
parents: 2246
diff changeset
   541
                            ].
2c093fe9ddb1 fix for win32 diff (which does not support -b option)
Claus Gittinger <cg@exept.de>
parents: 2246
diff changeset
   542
                            l1 add:line1.
2c093fe9ddb1 fix for win32 diff (which does not support -b option)
Claus Gittinger <cg@exept.de>
parents: 2246
diff changeset
   543
                            l2 at:idx1 put:line2.
313
c143d37be2e9 lines which differ only in blanks (indent) are shown light-blue
Claus Gittinger <cg@exept.de>
parents: 242
diff changeset
   544
                        ] ifFalse:[
2260
2c093fe9ddb1 fix for win32 diff (which does not support -b option)
Claus Gittinger <cg@exept.de>
parents: 2246
diff changeset
   545
                            line1 := Text string:(text1 at:idx1) 
544
dea45065e7f1 use Text instead of ColoredListEntry
Claus Gittinger <cg@exept.de>
parents: 533
diff changeset
   546
                                         foregroundColor:changedColor 
2260
2c093fe9ddb1 fix for win32 diff (which does not support -b option)
Claus Gittinger <cg@exept.de>
parents: 2246
diff changeset
   547
                                         backgroundColor:changedBgColor.
2c093fe9ddb1 fix for win32 diff (which does not support -b option)
Claus Gittinger <cg@exept.de>
parents: 2246
diff changeset
   548
                            l1 add:line1.
313
c143d37be2e9 lines which differ only in blanks (indent) are shown light-blue
Claus Gittinger <cg@exept.de>
parents: 242
diff changeset
   549
                        ]
183
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   550
                    ] ifFalse:[
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   551
                        l1 add:(text1 at:idx1).
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   552
                    ].
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   553
                    idx1 := idx1 + 1
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   554
                ] ifFalse:[
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   555
                    (entry at:1) == $> ifTrue:[
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   556
                        useColors ifTrue:[
313
c143d37be2e9 lines which differ only in blanks (indent) are shown light-blue
Claus Gittinger <cg@exept.de>
parents: 242
diff changeset
   557
                            (l1 size >= idx2
2260
2c093fe9ddb1 fix for win32 diff (which does not support -b option)
Claus Gittinger <cg@exept.de>
parents: 2246
diff changeset
   558
                            and:[(s1 := line1 := l1 at:idx2) notNil
2141
1758f387ebe7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1440
diff changeset
   559
                            and:[(s1 asString withoutSeparators = (text2 at:idx2) withoutSeparators)
1758f387ebe7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1440
diff changeset
   560
                                  "/ or:[(s1 asString withoutSeparators withTabsExpanded = (text2 at:idx2) withoutSeparators withTabsExpanded)]  
1758f387ebe7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1440
diff changeset
   561
                            ]]) ifTrue:[
2260
2c093fe9ddb1 fix for win32 diff (which does not support -b option)
Claus Gittinger <cg@exept.de>
parents: 2246
diff changeset
   562
                                line2 := Text string:(text2 at:idx2) 
2c093fe9ddb1 fix for win32 diff (which does not support -b option)
Claus Gittinger <cg@exept.de>
parents: 2246
diff changeset
   563
                                            foregroundColor:changedSpacesOnlyColor 
2c093fe9ddb1 fix for win32 diff (which does not support -b option)
Claus Gittinger <cg@exept.de>
parents: 2246
diff changeset
   564
                                            backgroundColor:changedSpacesOnlyBgColor.
2c093fe9ddb1 fix for win32 diff (which does not support -b option)
Claus Gittinger <cg@exept.de>
parents: 2246
diff changeset
   565
                                line1 := Text string:line1 asString 
2c093fe9ddb1 fix for win32 diff (which does not support -b option)
Claus Gittinger <cg@exept.de>
parents: 2246
diff changeset
   566
                                            foregroundColor:changedSpacesOnlyColor 
2c093fe9ddb1 fix for win32 diff (which does not support -b option)
Claus Gittinger <cg@exept.de>
parents: 2246
diff changeset
   567
                                            backgroundColor:changedSpacesOnlyBgColor.
2262
75d490e87d95 oops - care for diff -b space differences
Claus Gittinger <cg@exept.de>
parents: 2260
diff changeset
   568
                                line1 string withoutTrailingSeparators = line2 string withoutTrailingSeparators ifTrue:[
2260
2c093fe9ddb1 fix for win32 diff (which does not support -b option)
Claus Gittinger <cg@exept.de>
parents: 2246
diff changeset
   569
                                    line1 := line1 string.
2c093fe9ddb1 fix for win32 diff (which does not support -b option)
Claus Gittinger <cg@exept.de>
parents: 2246
diff changeset
   570
                                    line2 := line2 string.
6413
ee2f36cef562 care for space vs. tab
Claus Gittinger <cg@exept.de>
parents: 6397
diff changeset
   571
                                ] ifFalse:[
ee2f36cef562 care for space vs. tab
Claus Gittinger <cg@exept.de>
parents: 6397
diff changeset
   572
                                    line1 withoutSeparators withTabsExpanded = line2 withoutSeparators withTabsExpanded
ee2f36cef562 care for space vs. tab
Claus Gittinger <cg@exept.de>
parents: 6397
diff changeset
   573
                                    ifTrue:[
ee2f36cef562 care for space vs. tab
Claus Gittinger <cg@exept.de>
parents: 6397
diff changeset
   574
                                        line1 := line1 string.
ee2f36cef562 care for space vs. tab
Claus Gittinger <cg@exept.de>
parents: 6397
diff changeset
   575
                                        line2 := line2 string.
ee2f36cef562 care for space vs. tab
Claus Gittinger <cg@exept.de>
parents: 6397
diff changeset
   576
                                    ]
2260
2c093fe9ddb1 fix for win32 diff (which does not support -b option)
Claus Gittinger <cg@exept.de>
parents: 2246
diff changeset
   577
                                ].
2c093fe9ddb1 fix for win32 diff (which does not support -b option)
Claus Gittinger <cg@exept.de>
parents: 2246
diff changeset
   578
                                l2 add:line2.
2c093fe9ddb1 fix for win32 diff (which does not support -b option)
Claus Gittinger <cg@exept.de>
parents: 2246
diff changeset
   579
                                l1 at:idx2 put:line1.
313
c143d37be2e9 lines which differ only in blanks (indent) are shown light-blue
Claus Gittinger <cg@exept.de>
parents: 242
diff changeset
   580
                            ] ifFalse:[
2260
2c093fe9ddb1 fix for win32 diff (which does not support -b option)
Claus Gittinger <cg@exept.de>
parents: 2246
diff changeset
   581
                                line2 := Text string:(text2 at:idx2) foregroundColor:changedColor backgroundColor:changedBgColor.
2c093fe9ddb1 fix for win32 diff (which does not support -b option)
Claus Gittinger <cg@exept.de>
parents: 2246
diff changeset
   582
                                l2 add:line2
313
c143d37be2e9 lines which differ only in blanks (indent) are shown light-blue
Claus Gittinger <cg@exept.de>
parents: 242
diff changeset
   583
                            ]
183
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   584
                        ] ifFalse:[
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   585
                            l2 add:(text2 at:idx2).
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   586
                        ].
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   587
                        idx2 := idx2 + 1
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   588
                    ] ifFalse:[
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   589
                        (entry at:1) == $- ifTrue:[
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   590
                        ] ifFalse:[
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   591
                            state := #initial.
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   592
                            dIdx := dIdx - 1
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   593
                        ]
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   594
                    ]
2260
2c093fe9ddb1 fix for win32 diff (which does not support -b option)
Claus Gittinger <cg@exept.de>
parents: 2246
diff changeset
   595
                ].
183
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   596
            ] ifFalse:[
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   597
                state == #added ifTrue:[
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   598
                    (entry at:1) == $> ifTrue:[
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   599
                        useColors ifTrue:[
544
dea45065e7f1 use Text instead of ColoredListEntry
Claus Gittinger <cg@exept.de>
parents: 533
diff changeset
   600
                            l2 add:(Text string:(text2 at:idx2) foregroundColor:addedColor backgroundColor:addedBgColor )
183
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   601
                        ] ifFalse:[
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   602
                            l2 add:(text2 at:idx2).
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   603
                        ].
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   604
                        idx2 := idx2 + 1.
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   605
                        l1 add:nil
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   606
                    ] ifFalse:[
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   607
                        state := #initial.
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   608
                        dIdx := dIdx - 1
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   609
                    ]
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   610
                ] ifFalse:[
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   611
                    state == #deleted ifTrue:[
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   612
                        (entry at:1) == $< ifTrue:[
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   613
                            useColors ifTrue:[
544
dea45065e7f1 use Text instead of ColoredListEntry
Claus Gittinger <cg@exept.de>
parents: 533
diff changeset
   614
                                l1 add:(Text string:(text1 at:idx1) foregroundColor:removedColor backgroundColor:removedBgColor ).
183
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   615
                            ] ifFalse:[
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   616
                                l1 add:(text1 at:idx1).
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   617
                            ].
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   618
                            idx1 := idx1 + 1.
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   619
                            l2 add:nil
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   620
                        ] ifFalse:[
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   621
                            state := #initial.
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   622
                            dIdx := dIdx - 1
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   623
                        ]
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   624
                    ] 
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   625
                    "must be in finish otherwise"
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   626
                ]
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   627
            ]
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   628
        ].
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   629
        dIdx := dIdx + 1
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   630
    ].
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   631
    [l1 size < l2 size] whileTrue:[
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   632
        l1 add:''.
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   633
    ].
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   634
    [l2 size < l1 size] whileTrue:[
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   635
        l2 add:''.
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   636
    ].
2262
75d490e87d95 oops - care for diff -b space differences
Claus Gittinger <cg@exept.de>
parents: 2260
diff changeset
   637
75d490e87d95 oops - care for diff -b space differences
Claus Gittinger <cg@exept.de>
parents: 2260
diff changeset
   638
    "/ fixup - diff -b is ignoring lines which differ in leading space only ...
75d490e87d95 oops - care for diff -b space differences
Claus Gittinger <cg@exept.de>
parents: 2260
diff changeset
   639
    1 to:l1 size do:[:idx |
75d490e87d95 oops - care for diff -b space differences
Claus Gittinger <cg@exept.de>
parents: 2260
diff changeset
   640
        |line1 line2|
75d490e87d95 oops - care for diff -b space differences
Claus Gittinger <cg@exept.de>
parents: 2260
diff changeset
   641
75d490e87d95 oops - care for diff -b space differences
Claus Gittinger <cg@exept.de>
parents: 2260
diff changeset
   642
        line1 := l1 at:idx.
75d490e87d95 oops - care for diff -b space differences
Claus Gittinger <cg@exept.de>
parents: 2260
diff changeset
   643
        line2 := l2 at:idx.
2268
Claus Gittinger <cg@exept.de>
parents: 2262
diff changeset
   644
        (line1 notNil and:[line1 hasChangeOfEmphasis not]) ifTrue:[
Claus Gittinger <cg@exept.de>
parents: 2262
diff changeset
   645
            (line2 notNil and:[line2 hasChangeOfEmphasis not]) ifTrue:[
2262
75d490e87d95 oops - care for diff -b space differences
Claus Gittinger <cg@exept.de>
parents: 2260
diff changeset
   646
                line1 withTabsExpanded withoutTrailingSeparators
75d490e87d95 oops - care for diff -b space differences
Claus Gittinger <cg@exept.de>
parents: 2260
diff changeset
   647
                ~= line2 withTabsExpanded withoutTrailingSeparators 
75d490e87d95 oops - care for diff -b space differences
Claus Gittinger <cg@exept.de>
parents: 2260
diff changeset
   648
                ifTrue:[
75d490e87d95 oops - care for diff -b space differences
Claus Gittinger <cg@exept.de>
parents: 2260
diff changeset
   649
                    line1 := Text string:line1 
75d490e87d95 oops - care for diff -b space differences
Claus Gittinger <cg@exept.de>
parents: 2260
diff changeset
   650
                                 foregroundColor:changedSpacesOnlyColor
75d490e87d95 oops - care for diff -b space differences
Claus Gittinger <cg@exept.de>
parents: 2260
diff changeset
   651
                                 backgroundColor:changedSpacesOnlyBgColor.
75d490e87d95 oops - care for diff -b space differences
Claus Gittinger <cg@exept.de>
parents: 2260
diff changeset
   652
                    line2 := Text string:line2 
75d490e87d95 oops - care for diff -b space differences
Claus Gittinger <cg@exept.de>
parents: 2260
diff changeset
   653
                                 foregroundColor:changedSpacesOnlyColor 
75d490e87d95 oops - care for diff -b space differences
Claus Gittinger <cg@exept.de>
parents: 2260
diff changeset
   654
                                 backgroundColor:changedSpacesOnlyBgColor.
75d490e87d95 oops - care for diff -b space differences
Claus Gittinger <cg@exept.de>
parents: 2260
diff changeset
   655
                    l1 at:idx put:line1.
75d490e87d95 oops - care for diff -b space differences
Claus Gittinger <cg@exept.de>
parents: 2260
diff changeset
   656
                    l2 at:idx put:line2.
75d490e87d95 oops - care for diff -b space differences
Claus Gittinger <cg@exept.de>
parents: 2260
diff changeset
   657
                ]
75d490e87d95 oops - care for diff -b space differences
Claus Gittinger <cg@exept.de>
parents: 2260
diff changeset
   658
            ]        
75d490e87d95 oops - care for diff -b space differences
Claus Gittinger <cg@exept.de>
parents: 2260
diff changeset
   659
        ]
75d490e87d95 oops - care for diff -b space differences
Claus Gittinger <cg@exept.de>
parents: 2260
diff changeset
   660
    ].
75d490e87d95 oops - care for diff -b space differences
Claus Gittinger <cg@exept.de>
parents: 2260
diff changeset
   661
183
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   662
    textView1 list:l1.
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   663
    textView2 list:l2
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   664
2260
2c093fe9ddb1 fix for win32 diff (which does not support -b option)
Claus Gittinger <cg@exept.de>
parents: 2246
diff changeset
   665
    "Modified: / 13.7.1999 / 14:12:11 / cg"
183
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   666
! !
908f1f2c3ca0 added labels to diff-view
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   667
242
85bf88a27903 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   668
!DiffTextView class methodsFor:'documentation'!
85bf88a27903 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   669
85bf88a27903 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 183
diff changeset
   670
version
7526
616823c6a3da care for 16bit string which isn't
Claus Gittinger <cg@exept.de>
parents: 7177
diff changeset
   671
    ^ '$Header: /cvs/stx/stx/libtool/DiffTextView.st,v 1.46 2006-11-20 12:18:15 cg Exp $'
2268
Claus Gittinger <cg@exept.de>
parents: 2262
diff changeset
   672
! !