author | Jan Vrany <jan.vrany@fit.cvut.cz> |
Fri, 08 Feb 2013 08:35:48 +0100 | |
branch | jv |
changeset 12405 | 76f9a872362b |
parent 12128 | a7ff7d66ee85 |
parent 12383 | d1476f5b8c95 |
child 12431 | 9f0c59c742d5 |
permissions | -rw-r--r-- |
36 | 1 |
" |
2 |
COPYRIGHT (c) 1994 by Claus Gittinger |
|
45 | 3 |
All Rights Reserved |
36 | 4 |
|
5 |
This software is furnished under a license and may be used |
|
6 |
only in accordance with the terms of that license and with the |
|
7 |
inclusion of the above copyright notice. This software may not |
|
8 |
be provided or otherwise made available to, or used by, any |
|
9 |
other person. No title to or ownership of the software is |
|
10 |
hereby transferred. |
|
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 | 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 | 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 | 21 |
! |
22 |
||
23 |
!DiffTextView class methodsFor:'documentation'! |
|
24 |
||
25 |
copyright |
|
26 |
" |
|
27 |
COPYRIGHT (c) 1994 by Claus Gittinger |
|
45 | 28 |
All Rights Reserved |
36 | 29 |
|
30 |
This software is furnished under a license and may be used |
|
31 |
only in accordance with the terms of that license and with the |
|
32 |
inclusion of the above copyright notice. This software may not |
|
33 |
be provided or otherwise made available to, or used by, any |
|
34 |
other person. No title to or ownership of the software is |
|
35 |
hereby transferred. |
|
36 |
" |
|
37 |
! |
|
38 |
||
39 |
documentation |
|
40 |
" |
|
507 | 41 |
a view showing diff output (see unix manual pages) |
42 |
in a user-friendly form. |
|
36 | 43 |
The view is created and opened with: |
44 |
||
507 | 45 |
d := DiffTextView openOn:text1 and:text2 |
46 |
||
47 |
or: |
|
48 |
d := DiffTextView openOn:text1 label:l1 |
|
49 |
and:text2 label:l2 |
|
36 | 50 |
|
507 | 51 |
and it will show the differences side-by-side. |
533 | 52 |
|
2240 | 53 |
The colors mean: |
54 |
red - removed |
|
55 |
green - added |
|
56 |
blue - changed |
|
57 |
light-blue changed, but not really (i.e. spaces only) |
|
58 |
||
59 |
For a real world application and use of this widget, |
|
60 |
see the ChangesBrowsers `compare', |
|
61 |
or the browsers 'compare with repository' functions. |
|
507 | 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 | 68 |
[see also:] |
1276 | 69 |
TextView EditTextView Diff3TextView |
519 | 70 |
|
71 |
[author:] |
|
72 |
Claus Gittinger |
|
36 | 73 |
" |
1276 | 74 |
! |
75 |
||
76 |
examples |
|
77 |
" |
|
78 |
[exBegin] |
|
79 |
|text1 text2| |
|
80 |
||
81 |
text1 := 'hello world |
|
82 |
here is some difference |
|
83 |
more text |
|
84 |
this line has been removed |
|
85 |
more text |
|
86 |
more text |
|
87 |
'. |
|
88 |
||
89 |
text2 := 'hello world |
|
90 |
where is the difference ? |
|
91 |
more text |
|
92 |
more text |
|
93 |
more text |
|
94 |
this line has been added |
|
95 |
'. |
|
96 |
||
97 |
DiffTextView openOn:text1 label:'text1' |
|
98 |
and:text2 label:'text2' |
|
99 |
[exEnd] |
|
100 |
" |
|
242 | 101 |
! ! |
36 | 102 |
|
12405
76f9a872362b
Merged 3efd83b86c07 and 1206aff1f11 (branch default - CVS HEAD)
Jan Vrany <jan.vrany@fit.cvut.cz>
diff
changeset
|
103 |
|
2716
8451e7057f00
some common startup protocol between DiffViewer and VersionDiffBrowser
Claus Gittinger <cg@exept.de>
parents:
2268
diff
changeset
|
104 |
!DiffTextView class methodsFor:'instance creation'! |
8451e7057f00
some common startup protocol between DiffViewer and VersionDiffBrowser
Claus Gittinger <cg@exept.de>
parents:
2268
diff
changeset
|
105 |
|
2948
cf5b7f232536
VersionDIffBrowser compatibility
Claus Gittinger <cg@exept.de>
parents:
2848
diff
changeset
|
106 |
openOnClass:classA labelA:lblA andClass:classB labelB:lblB title:title ifSame:sameAction |
cf5b7f232536
VersionDIffBrowser compatibility
Claus Gittinger <cg@exept.de>
parents:
2848
diff
changeset
|
107 |
"provided for protocol compatibility with the VersionDiffBrowser; |
cf5b7f232536
VersionDIffBrowser compatibility
Claus Gittinger <cg@exept.de>
parents:
2848
diff
changeset
|
108 |
actually, the classes are ignored here" |
cf5b7f232536
VersionDIffBrowser compatibility
Claus Gittinger <cg@exept.de>
parents:
2848
diff
changeset
|
109 |
|
cf5b7f232536
VersionDIffBrowser compatibility
Claus Gittinger <cg@exept.de>
parents:
2848
diff
changeset
|
110 |
|v aStream sourceA sourceB| |
cf5b7f232536
VersionDIffBrowser compatibility
Claus Gittinger <cg@exept.de>
parents:
2848
diff
changeset
|
111 |
|
cf5b7f232536
VersionDIffBrowser compatibility
Claus Gittinger <cg@exept.de>
parents:
2848
diff
changeset
|
112 |
aStream := '' writeStream. |
cf5b7f232536
VersionDIffBrowser compatibility
Claus Gittinger <cg@exept.de>
parents:
2848
diff
changeset
|
113 |
Method flushSourceStreamCache. |
cf5b7f232536
VersionDIffBrowser compatibility
Claus Gittinger <cg@exept.de>
parents:
2848
diff
changeset
|
114 |
classA fileOutOn:aStream withTimeStamp:false. |
cf5b7f232536
VersionDIffBrowser compatibility
Claus Gittinger <cg@exept.de>
parents:
2848
diff
changeset
|
115 |
sourceA := aStream contents asString. |
cf5b7f232536
VersionDIffBrowser compatibility
Claus Gittinger <cg@exept.de>
parents:
2848
diff
changeset
|
116 |
|
cf5b7f232536
VersionDIffBrowser compatibility
Claus Gittinger <cg@exept.de>
parents:
2848
diff
changeset
|
117 |
aStream := '' writeStream. |
cf5b7f232536
VersionDIffBrowser compatibility
Claus Gittinger <cg@exept.de>
parents:
2848
diff
changeset
|
118 |
Method flushSourceStreamCache. |
cf5b7f232536
VersionDIffBrowser compatibility
Claus Gittinger <cg@exept.de>
parents:
2848
diff
changeset
|
119 |
classB fileOutOn:aStream withTimeStamp:false. |
cf5b7f232536
VersionDIffBrowser compatibility
Claus Gittinger <cg@exept.de>
parents:
2848
diff
changeset
|
120 |
sourceB := aStream contents asString. |
cf5b7f232536
VersionDIffBrowser compatibility
Claus Gittinger <cg@exept.de>
parents:
2848
diff
changeset
|
121 |
|
cf5b7f232536
VersionDIffBrowser compatibility
Claus Gittinger <cg@exept.de>
parents:
2848
diff
changeset
|
122 |
v := self |
3755 | 123 |
openOn:sourceA label:lblA |
124 |
and:sourceB label:lblB. |
|
8334 | 125 |
v topView label:title. |
2948
cf5b7f232536
VersionDIffBrowser compatibility
Claus Gittinger <cg@exept.de>
parents:
2848
diff
changeset
|
126 |
^ v |
cf5b7f232536
VersionDIffBrowser compatibility
Claus Gittinger <cg@exept.de>
parents:
2848
diff
changeset
|
127 |
! |
cf5b7f232536
VersionDIffBrowser compatibility
Claus Gittinger <cg@exept.de>
parents:
2848
diff
changeset
|
128 |
|
2716
8451e7057f00
some common startup protocol between DiffViewer and VersionDiffBrowser
Claus Gittinger <cg@exept.de>
parents:
2268
diff
changeset
|
129 |
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
|
130 |
"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
|
131 |
actually, the class is ignored here" |
8451e7057f00
some common startup protocol between DiffViewer and VersionDiffBrowser
Claus Gittinger <cg@exept.de>
parents:
2268
diff
changeset
|
132 |
|
3755 | 133 |
^ self |
134 |
openOnClass:someClass |
|
135 |
labelA:lblA sourceA:sourceA |
|
136 |
labelB:lblB sourceB:sourceB |
|
137 |
title:'Comparing ' , someClass name. |
|
2716
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 |
|
8451e7057f00
some common startup protocol between DiffViewer and VersionDiffBrowser
Claus Gittinger <cg@exept.de>
parents:
2268
diff
changeset
|
140 |
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
|
141 |
"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
|
142 |
actually, the class is ignored here" |
8451e7057f00
some common startup protocol between DiffViewer and VersionDiffBrowser
Claus Gittinger <cg@exept.de>
parents:
2268
diff
changeset
|
143 |
|
2848 | 144 |
^ self |
3755 | 145 |
openOnClass:someClass |
146 |
labelA:lblA sourceA:sourceA |
|
147 |
labelB:lblB sourceB:sourceB |
|
148 |
title:title ifSame:nil |
|
2848 | 149 |
! |
150 |
||
151 |
openOnClass:someClass labelA:lblA sourceA:sourceA labelB:lblB sourceB:sourceB title:title ifSame:sameAction |
|
152 |
"provided for protocol compatibility with the VersionDiffBrowser; |
|
153 |
actually, the class is ignored here" |
|
154 |
||
2716
8451e7057f00
some common startup protocol between DiffViewer and VersionDiffBrowser
Claus Gittinger <cg@exept.de>
parents:
2268
diff
changeset
|
155 |
|v| |
8451e7057f00
some common startup protocol between DiffViewer and VersionDiffBrowser
Claus Gittinger <cg@exept.de>
parents:
2268
diff
changeset
|
156 |
|
2750 | 157 |
v := self |
3755 | 158 |
openOn:sourceA label:lblA |
159 |
and:sourceB label:lblB. |
|
3050 | 160 |
v topView label:title. |
2716
8451e7057f00
some common startup protocol between DiffViewer and VersionDiffBrowser
Claus Gittinger <cg@exept.de>
parents:
2268
diff
changeset
|
161 |
^ v |
8451e7057f00
some common startup protocol between DiffViewer and VersionDiffBrowser
Claus Gittinger <cg@exept.de>
parents:
2268
diff
changeset
|
162 |
! ! |
8451e7057f00
some common startup protocol between DiffViewer and VersionDiffBrowser
Claus Gittinger <cg@exept.de>
parents:
2268
diff
changeset
|
163 |
|
12405
76f9a872362b
Merged 3efd83b86c07 and 1206aff1f11 (branch default - CVS HEAD)
Jan Vrany <jan.vrany@fit.cvut.cz>
diff
changeset
|
164 |
|
45 | 165 |
!DiffTextView class methodsFor:'defaults'! |
166 |
||
167 |
diffCommand |
|
1440
6a68adba9c33
allow configuration of diff command;
Claus Gittinger <cg@exept.de>
parents:
1276
diff
changeset
|
168 |
"return the diff-command (with argument placeHolders)" |
6a68adba9c33
allow configuration of diff command;
Claus Gittinger <cg@exept.de>
parents:
1276
diff
changeset
|
169 |
|
8934
7cc2affd9bb9
started to refactor into DiffListUtility
Claus Gittinger <cg@exept.de>
parents:
8676
diff
changeset
|
170 |
"/ forwarded, for backward compatibility... |
7cc2affd9bb9
started to refactor into DiffListUtility
Claus Gittinger <cg@exept.de>
parents:
8676
diff
changeset
|
171 |
^ DiffListUtility diffCommand |
1440
6a68adba9c33
allow configuration of diff command;
Claus Gittinger <cg@exept.de>
parents:
1276
diff
changeset
|
172 |
! |
507 | 173 |
|
1440
6a68adba9c33
allow configuration of diff command;
Claus Gittinger <cg@exept.de>
parents:
1276
diff
changeset
|
174 |
diffCommandTemplate:aCommandTemplateString |
6a68adba9c33
allow configuration of diff command;
Claus Gittinger <cg@exept.de>
parents:
1276
diff
changeset
|
175 |
"set the diff-command template" |
6a68adba9c33
allow configuration of diff command;
Claus Gittinger <cg@exept.de>
parents:
1276
diff
changeset
|
176 |
|
8934
7cc2affd9bb9
started to refactor into DiffListUtility
Claus Gittinger <cg@exept.de>
parents:
8676
diff
changeset
|
177 |
"/ forwarded for backward compatibility |
7cc2affd9bb9
started to refactor into DiffListUtility
Claus Gittinger <cg@exept.de>
parents:
8676
diff
changeset
|
178 |
DiffListUtility diffCommandTemplate:aCommandTemplateString |
45 | 179 |
! ! |
180 |
||
12405
76f9a872362b
Merged 3efd83b86c07 and 1206aff1f11 (branch default - CVS HEAD)
Jan Vrany <jan.vrany@fit.cvut.cz>
diff
changeset
|
181 |
|
36 | 182 |
!DiffTextView methodsFor:'accessing'! |
183 |
||
184 |
text1:t1 text2:t2 |
|
1440
6a68adba9c33
allow configuration of diff command;
Claus Gittinger <cg@exept.de>
parents:
1276
diff
changeset
|
185 |
"set the two texts which are to be diffed; |
6a68adba9c33
allow configuration of diff command;
Claus Gittinger <cg@exept.de>
parents:
1276
diff
changeset
|
186 |
execute DiffCommand and update the two textViews." |
507 | 187 |
|
6577
51b89422d7de
be more robust w.r.t. errors while diffing
Claus Gittinger <cg@exept.de>
parents:
6413
diff
changeset
|
188 |
|text1 text2 diffList| |
36 | 189 |
|
12383 | 190 |
text1 := t1 asStringCollection. |
191 |
text2 := t2 asStringCollection. |
|
36 | 192 |
|
7768 | 193 |
diffList := self diffListFor:text1 and:text2. |
36 | 194 |
|
195 |
self updateListsFrom:text1 and:text2 diffs:diffList |
|
196 |
||
197 |
" |
|
198 |
|v| |
|
199 |
||
200 |
v := HVScrollableView for:DiffTextView. |
|
201 |
v scrolledView text1:('../libview/Color.st' asFilename readStream contents) |
|
507 | 202 |
text2:('../libview/Color.st.old' asFilename readStream contents). |
36 | 203 |
v open |
204 |
" |
|
205 |
||
206 |
" |
|
207 |
|v t1 t2| |
|
208 |
||
209 |
t1 := ' |
|
210 |
one |
|
211 |
two |
|
212 |
three |
|
213 |
four |
|
214 |
'. |
|
215 |
t2 := ' |
|
216 |
one |
|
217 |
two-a |
|
218 |
two-b |
|
219 |
three |
|
220 |
three-b |
|
221 |
four |
|
222 |
'. |
|
223 |
||
224 |
v := DiffTextView new. |
|
225 |
v text1:t1 text2:t2. |
|
69 | 226 |
v open |
36 | 227 |
" |
507 | 228 |
|
7768 | 229 |
"Modified: / 27-03-2007 / 12:06:46 / cg" |
36 | 230 |
! ! |
183 | 231 |
|
12405
76f9a872362b
Merged 3efd83b86c07 and 1206aff1f11 (branch default - CVS HEAD)
Jan Vrany <jan.vrany@fit.cvut.cz>
diff
changeset
|
232 |
|
183 | 233 |
!DiffTextView methodsFor:'initialization'! |
234 |
||
2246
34262ef77055
comment; look if diff is present and handle the bad case gracious (win32)
Claus Gittinger <cg@exept.de>
parents:
2240
diff
changeset
|
235 |
addNextPreviousButtons |
34262ef77055
comment; look if diff is present and handle the bad case gracious (win32)
Claus Gittinger <cg@exept.de>
parents:
2240
diff
changeset
|
236 |
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
|
237 |
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
|
238 |
! |
34262ef77055
comment; look if diff is present and handle the bad case gracious (win32)
Claus Gittinger <cg@exept.de>
parents:
2240
diff
changeset
|
239 |
|
183 | 240 |
initStyle |
241 |
super initStyle. |
|
242 |
||
243 |
showSeparators := false. |
|
244 |
||
544
dea45065e7f1
use Text instead of ColoredListEntry
Claus Gittinger <cg@exept.de>
parents:
533
diff
changeset
|
245 |
(useColors := device hasColors) ifTrue:[ |
2240 | 246 |
addedColor := Color white. |
247 |
addedBgColor := Color red. |
|
183 | 248 |
|
2240 | 249 |
removedColor := Color black. |
250 |
removedBgColor := Color green. |
|
183 | 251 |
|
544
dea45065e7f1
use Text instead of ColoredListEntry
Claus Gittinger <cg@exept.de>
parents:
533
diff
changeset
|
252 |
changedColor := Color white. |
dea45065e7f1
use Text instead of ColoredListEntry
Claus Gittinger <cg@exept.de>
parents:
533
diff
changeset
|
253 |
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
|
254 |
|
544
dea45065e7f1
use Text instead of ColoredListEntry
Claus Gittinger <cg@exept.de>
parents:
533
diff
changeset
|
255 |
changedSpacesOnlyColor := Color white. |
dea45065e7f1
use Text instead of ColoredListEntry
Claus Gittinger <cg@exept.de>
parents:
533
diff
changeset
|
256 |
changedSpacesOnlyBgColor := Color blue lightened. |
dea45065e7f1
use Text instead of ColoredListEntry
Claus Gittinger <cg@exept.de>
parents:
533
diff
changeset
|
257 |
] ifFalse:[ |
623 | 258 |
showSeparators := true. |
259 |
||
260 |
(useColors := device hasGreyscales) ifTrue:[ |
|
261 |
addedBgColor := removedBgColor := changedBgColor := Color grey:80. |
|
262 |
addedColor := removedColor := changedColor := Color black. |
|
263 |
] ifFalse:[ |
|
264 |
addedBgColor := removedBgColor := changedBgColor := Color black. |
|
265 |
addedColor := removedColor := changedColor := Color white. |
|
266 |
]. |
|
267 |
||
268 |
changedSpacesOnlyColor := Color white. |
|
269 |
changedSpacesOnlyBgColor := Color black. |
|
183 | 270 |
]. |
271 |
||
272 |
"Created: 16.11.1995 / 16:59:48 / cg" |
|
623 | 273 |
"Modified: 14.6.1996 / 16:14:39 / cg" |
183 | 274 |
! ! |
275 |
||
12405
76f9a872362b
Merged 3efd83b86c07 and 1206aff1f11 (branch default - CVS HEAD)
Jan Vrany <jan.vrany@fit.cvut.cz>
diff
changeset
|
276 |
|
183 | 277 |
!DiffTextView methodsFor:'private'! |
278 |
||
6577
51b89422d7de
be more robust w.r.t. errors while diffing
Claus Gittinger <cg@exept.de>
parents:
6413
diff
changeset
|
279 |
diffListFor:text1 and:text2 |
8934
7cc2affd9bb9
started to refactor into DiffListUtility
Claus Gittinger <cg@exept.de>
parents:
8676
diff
changeset
|
280 |
"return a raw difflist for the two texts which are to be diffed" |
7602
cf179604a91b
Quick compare if both strings are the same
Stefan Vogel <sv@exept.de>
parents:
7526
diff
changeset
|
281 |
|
8934
7cc2affd9bb9
started to refactor into DiffListUtility
Claus Gittinger <cg@exept.de>
parents:
8676
diff
changeset
|
282 |
^ DiffListUtility diffListFor:text1 and:text2 |
6577
51b89422d7de
be more robust w.r.t. errors while diffing
Claus Gittinger <cg@exept.de>
parents:
6413
diff
changeset
|
283 |
! |
51b89422d7de
be more robust w.r.t. errors while diffing
Claus Gittinger <cg@exept.de>
parents:
6413
diff
changeset
|
284 |
|
8934
7cc2affd9bb9
started to refactor into DiffListUtility
Claus Gittinger <cg@exept.de>
parents:
8676
diff
changeset
|
285 |
processDiffList:diffList from:text1 and:text2 |
7cc2affd9bb9
started to refactor into DiffListUtility
Claus Gittinger <cg@exept.de>
parents:
8676
diff
changeset
|
286 |
"given the two texts in text1 and text2, and the diff-output in diffList, |
7cc2affd9bb9
started to refactor into DiffListUtility
Claus Gittinger <cg@exept.de>
parents:
8676
diff
changeset
|
287 |
return new left and right lists." |
7177 | 288 |
|
8934
7cc2affd9bb9
started to refactor into DiffListUtility
Claus Gittinger <cg@exept.de>
parents:
8676
diff
changeset
|
289 |
|idx1 idx2 dIdx dEnd state s nr1 nr2 nr3 op entry l1 l2 any delta s1 s2 line1 line2| |
7cc2affd9bb9
started to refactor into DiffListUtility
Claus Gittinger <cg@exept.de>
parents:
8676
diff
changeset
|
290 |
|
7cc2affd9bb9
started to refactor into DiffListUtility
Claus Gittinger <cg@exept.de>
parents:
8676
diff
changeset
|
291 |
diffList size == 1 ifTrue:[ |
7cc2affd9bb9
started to refactor into DiffListUtility
Claus Gittinger <cg@exept.de>
parents:
8676
diff
changeset
|
292 |
^ { diffList. diffList } |
6577
51b89422d7de
be more robust w.r.t. errors while diffing
Claus Gittinger <cg@exept.de>
parents:
6413
diff
changeset
|
293 |
]. |
183 | 294 |
|
507 | 295 |
diffLineNumbers := OrderedCollection new. |
296 |
||
183 | 297 |
l1 := OrderedCollection new. |
298 |
l2 := OrderedCollection new. |
|
299 |
||
300 |
idx1 := 1. |
|
301 |
idx2 := 1. |
|
302 |
||
303 |
dIdx := 1. |
|
304 |
dEnd := diffList size + 1. |
|
305 |
state := #initial. |
|
306 |
[dIdx <= dEnd] whileTrue:[ |
|
307 |
dIdx == dEnd ifTrue:[ |
|
308 |
"dummy cleanup entry" |
|
309 |
entry := nil. |
|
310 |
state := #initial. |
|
311 |
] ifFalse:[ |
|
312 |
entry := diffList at:dIdx. |
|
313 |
]. |
|
314 |
||
315 |
state == #initial ifTrue:[ |
|
316 |
"entry is of the form <nr> <op> <offs> [<offs2>]" |
|
317 |
||
318 |
" |
|
319 |
fill up to size difference from previous change |
|
320 |
" |
|
321 |
delta := l1 size - l2 size. |
|
322 |
delta > 0 ifTrue:[ |
|
323 |
delta timesRepeat:[l2 add:nil] |
|
324 |
] ifFalse:[ |
|
325 |
delta < 0 ifTrue:[ |
|
326 |
delta negated timesRepeat:[l1 add:nil] |
|
327 |
] |
|
328 |
]. |
|
329 |
||
330 |
" |
|
331 |
except for the first chunk, add a separating line |
|
332 |
" |
|
333 |
l1 size ~~ 0 ifTrue:[ |
|
334 |
showSeparators ifTrue:[ |
|
335 |
l1 add:'--------'. |
|
336 |
l2 add:'--------'. |
|
337 |
] |
|
338 |
]. |
|
339 |
" |
|
340 |
in cleanup ? |
|
341 |
" |
|
342 |
entry isNil ifTrue:[ |
|
343 |
nr1 := text1 size + 1. |
|
344 |
nr2 := text2 size + 1. |
|
345 |
state := #finish. |
|
346 |
] ifFalse:[ |
|
507 | 347 |
diffLineNumbers add:l1 size. |
348 |
||
183 | 349 |
s := ReadStream on:entry. |
350 |
nr1 := Integer readFrom:s. |
|
351 |
s peek == $, ifTrue:[ |
|
352 |
s next. |
|
353 |
Integer readFrom:s |
|
354 |
]. |
|
355 |
op := s next. |
|
356 |
nr2 := Integer readFrom:s. |
|
357 |
s peek == $, ifTrue:[ |
|
358 |
s next. |
|
359 |
nr3 := Integer readFrom:s |
|
360 |
] ifFalse:[ |
|
361 |
nr3 := nil |
|
362 |
]. |
|
363 |
||
364 |
op == $c ifTrue:[ |
|
365 |
state := #changed. |
|
366 |
] 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
|
367 |
(op == $a) ifTrue:[ |
183 | 368 |
state := #added. |
369 |
] ifFalse:[ |
|
370 |
op == $d ifTrue:[ |
|
371 |
state := #deleted |
|
372 |
] ifFalse:[ |
|
373 |
self halt:'unexpected diff entry'. |
|
374 |
] |
|
375 |
] |
|
376 |
]. |
|
377 |
||
378 |
]. |
|
379 |
||
380 |
"/ nr1 print. ' ' print. op print. ' ' print. nr2 print. ' , ' print. nr3 printNL. |
|
381 |
||
382 |
" |
|
383 |
copy over unchanged lines |
|
384 |
" |
|
385 |
any := false. |
|
386 |
[idx1 < nr1] whileTrue:[ |
|
387 |
"/ '< add:' print. idx1 printNL. |
|
388 |
l1 add:(text1 at:idx1). |
|
389 |
idx1 := idx1 + 1. |
|
390 |
any := true. |
|
391 |
]. |
|
392 |
[idx2 < nr2] whileTrue:[ |
|
393 |
"/ '> add:' print. idx2 printNL. |
|
394 |
l2 add:(text2 at:idx2). |
|
395 |
idx2 := idx2 + 1. |
|
396 |
any := true. |
|
397 |
]. |
|
398 |
||
399 |
state == #added ifTrue:[ |
|
4489 | 400 |
l1 add:(text1 at:idx1 ifAbsent:''). |
183 | 401 |
idx1 := idx1 + 1. |
402 |
]. |
|
403 |
state == #deleted ifTrue:[ |
|
4489 | 404 |
l2 add:(text2 at:idx2 ifAbsent:''). |
183 | 405 |
idx2 := idx2 + 1. |
406 |
]. |
|
407 |
||
408 |
||
409 |
" |
|
410 |
add a separating line, except at end |
|
411 |
" |
|
412 |
any ifTrue:[ |
|
413 |
state ~~ #finish ifTrue:[ |
|
414 |
showSeparators ifTrue:[ |
|
415 |
l1 add:'--------'. |
|
416 |
l2 add:'--------'. |
|
417 |
] |
|
418 |
] |
|
419 |
]. |
|
420 |
||
421 |
] ifFalse:[ |
|
422 |
state == #changed ifTrue:[ |
|
2260
2c093fe9ddb1
fix for win32 diff (which does not support -b option)
Claus Gittinger <cg@exept.de>
parents:
2246
diff
changeset
|
423 |
line1 := line2 := nil. |
183 | 424 |
(entry at:1) == $< ifTrue:[ |
425 |
useColors ifTrue:[ |
|
313
c143d37be2e9
lines which differ only in blanks (indent) are shown light-blue
Claus Gittinger <cg@exept.de>
parents:
242
diff
changeset
|
426 |
(l2 size >= idx1 |
2260
2c093fe9ddb1
fix for win32 diff (which does not support -b option)
Claus Gittinger <cg@exept.de>
parents:
2246
diff
changeset
|
427 |
and:[(s2 := line2 := l2 at:idx1) notNil |
8934
7cc2affd9bb9
started to refactor into DiffListUtility
Claus Gittinger <cg@exept.de>
parents:
8676
diff
changeset
|
428 |
and:[(s2 asString string withoutSeparators = (text1 at:idx1) string withoutSeparators) |
2141 | 429 |
"/ or:[(s2 asString withoutSeparators withTabsExpanded = (text1 at:idx1) withoutSeparators withTabsExpanded)] |
430 |
]]) ifTrue:[ |
|
2260
2c093fe9ddb1
fix for win32 diff (which does not support -b option)
Claus Gittinger <cg@exept.de>
parents:
2246
diff
changeset
|
431 |
line1 := Text string:(text1 at:idx1) |
544
dea45065e7f1
use Text instead of ColoredListEntry
Claus Gittinger <cg@exept.de>
parents:
533
diff
changeset
|
432 |
foregroundColor:changedSpacesOnlyColor |
2260
2c093fe9ddb1
fix for win32 diff (which does not support -b option)
Claus Gittinger <cg@exept.de>
parents:
2246
diff
changeset
|
433 |
backgroundColor:changedSpacesOnlyBgColor. |
2c093fe9ddb1
fix for win32 diff (which does not support -b option)
Claus Gittinger <cg@exept.de>
parents:
2246
diff
changeset
|
434 |
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
|
435 |
foregroundColor:changedSpacesOnlyColor |
2c093fe9ddb1
fix for win32 diff (which does not support -b option)
Claus Gittinger <cg@exept.de>
parents:
2246
diff
changeset
|
436 |
backgroundColor:changedSpacesOnlyBgColor. |
2c093fe9ddb1
fix for win32 diff (which does not support -b option)
Claus Gittinger <cg@exept.de>
parents:
2246
diff
changeset
|
437 |
|
2262
75d490e87d95
oops - care for diff -b space differences
Claus Gittinger <cg@exept.de>
parents:
2260
diff
changeset
|
438 |
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
|
439 |
line1 := line1 string. |
2c093fe9ddb1
fix for win32 diff (which does not support -b option)
Claus Gittinger <cg@exept.de>
parents:
2246
diff
changeset
|
440 |
line2 := line2 string. |
6413 | 441 |
] ifFalse:[ |
442 |
line1 withoutSeparators withTabsExpanded = line2 withoutSeparators withTabsExpanded |
|
443 |
ifTrue:[ |
|
444 |
line1 := line1 string. |
|
445 |
line2 := line2 string. |
|
446 |
] |
|
2260
2c093fe9ddb1
fix for win32 diff (which does not support -b option)
Claus Gittinger <cg@exept.de>
parents:
2246
diff
changeset
|
447 |
]. |
2c093fe9ddb1
fix for win32 diff (which does not support -b option)
Claus Gittinger <cg@exept.de>
parents:
2246
diff
changeset
|
448 |
l1 add:line1. |
2c093fe9ddb1
fix for win32 diff (which does not support -b option)
Claus Gittinger <cg@exept.de>
parents:
2246
diff
changeset
|
449 |
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
|
450 |
] ifFalse:[ |
2260
2c093fe9ddb1
fix for win32 diff (which does not support -b option)
Claus Gittinger <cg@exept.de>
parents:
2246
diff
changeset
|
451 |
line1 := Text string:(text1 at:idx1) |
544
dea45065e7f1
use Text instead of ColoredListEntry
Claus Gittinger <cg@exept.de>
parents:
533
diff
changeset
|
452 |
foregroundColor:changedColor |
2260
2c093fe9ddb1
fix for win32 diff (which does not support -b option)
Claus Gittinger <cg@exept.de>
parents:
2246
diff
changeset
|
453 |
backgroundColor:changedBgColor. |
2c093fe9ddb1
fix for win32 diff (which does not support -b option)
Claus Gittinger <cg@exept.de>
parents:
2246
diff
changeset
|
454 |
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
|
455 |
] |
183 | 456 |
] ifFalse:[ |
457 |
l1 add:(text1 at:idx1). |
|
458 |
]. |
|
459 |
idx1 := idx1 + 1 |
|
460 |
] ifFalse:[ |
|
461 |
(entry at:1) == $> ifTrue:[ |
|
462 |
useColors ifTrue:[ |
|
313
c143d37be2e9
lines which differ only in blanks (indent) are shown light-blue
Claus Gittinger <cg@exept.de>
parents:
242
diff
changeset
|
463 |
(l1 size >= idx2 |
2260
2c093fe9ddb1
fix for win32 diff (which does not support -b option)
Claus Gittinger <cg@exept.de>
parents:
2246
diff
changeset
|
464 |
and:[(s1 := line1 := l1 at:idx2) notNil |
8934
7cc2affd9bb9
started to refactor into DiffListUtility
Claus Gittinger <cg@exept.de>
parents:
8676
diff
changeset
|
465 |
and:[(s1 asString string withoutSeparators = (text2 at:idx2) string withoutSeparators) |
2141 | 466 |
"/ or:[(s1 asString withoutSeparators withTabsExpanded = (text2 at:idx2) withoutSeparators withTabsExpanded)] |
467 |
]]) ifTrue:[ |
|
2260
2c093fe9ddb1
fix for win32 diff (which does not support -b option)
Claus Gittinger <cg@exept.de>
parents:
2246
diff
changeset
|
468 |
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
|
469 |
foregroundColor:changedSpacesOnlyColor |
2c093fe9ddb1
fix for win32 diff (which does not support -b option)
Claus Gittinger <cg@exept.de>
parents:
2246
diff
changeset
|
470 |
backgroundColor:changedSpacesOnlyBgColor. |
2c093fe9ddb1
fix for win32 diff (which does not support -b option)
Claus Gittinger <cg@exept.de>
parents:
2246
diff
changeset
|
471 |
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
|
472 |
foregroundColor:changedSpacesOnlyColor |
2c093fe9ddb1
fix for win32 diff (which does not support -b option)
Claus Gittinger <cg@exept.de>
parents:
2246
diff
changeset
|
473 |
backgroundColor:changedSpacesOnlyBgColor. |
2262
75d490e87d95
oops - care for diff -b space differences
Claus Gittinger <cg@exept.de>
parents:
2260
diff
changeset
|
474 |
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
|
475 |
line1 := line1 string. |
2c093fe9ddb1
fix for win32 diff (which does not support -b option)
Claus Gittinger <cg@exept.de>
parents:
2246
diff
changeset
|
476 |
line2 := line2 string. |
6413 | 477 |
] ifFalse:[ |
478 |
line1 withoutSeparators withTabsExpanded = line2 withoutSeparators withTabsExpanded |
|
479 |
ifTrue:[ |
|
480 |
line1 := line1 string. |
|
481 |
line2 := line2 string. |
|
482 |
] |
|
2260
2c093fe9ddb1
fix for win32 diff (which does not support -b option)
Claus Gittinger <cg@exept.de>
parents:
2246
diff
changeset
|
483 |
]. |
2c093fe9ddb1
fix for win32 diff (which does not support -b option)
Claus Gittinger <cg@exept.de>
parents:
2246
diff
changeset
|
484 |
l2 add:line2. |
2c093fe9ddb1
fix for win32 diff (which does not support -b option)
Claus Gittinger <cg@exept.de>
parents:
2246
diff
changeset
|
485 |
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
|
486 |
] ifFalse:[ |
2260
2c093fe9ddb1
fix for win32 diff (which does not support -b option)
Claus Gittinger <cg@exept.de>
parents:
2246
diff
changeset
|
487 |
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
|
488 |
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
|
489 |
] |
183 | 490 |
] ifFalse:[ |
491 |
l2 add:(text2 at:idx2). |
|
492 |
]. |
|
493 |
idx2 := idx2 + 1 |
|
494 |
] ifFalse:[ |
|
495 |
(entry at:1) == $- ifTrue:[ |
|
496 |
] ifFalse:[ |
|
497 |
state := #initial. |
|
498 |
dIdx := dIdx - 1 |
|
499 |
] |
|
500 |
] |
|
2260
2c093fe9ddb1
fix for win32 diff (which does not support -b option)
Claus Gittinger <cg@exept.de>
parents:
2246
diff
changeset
|
501 |
]. |
183 | 502 |
] ifFalse:[ |
503 |
state == #added ifTrue:[ |
|
504 |
(entry at:1) == $> ifTrue:[ |
|
505 |
useColors ifTrue:[ |
|
544
dea45065e7f1
use Text instead of ColoredListEntry
Claus Gittinger <cg@exept.de>
parents:
533
diff
changeset
|
506 |
l2 add:(Text string:(text2 at:idx2) foregroundColor:addedColor backgroundColor:addedBgColor ) |
183 | 507 |
] ifFalse:[ |
508 |
l2 add:(text2 at:idx2). |
|
509 |
]. |
|
510 |
idx2 := idx2 + 1. |
|
511 |
l1 add:nil |
|
512 |
] ifFalse:[ |
|
513 |
state := #initial. |
|
514 |
dIdx := dIdx - 1 |
|
515 |
] |
|
516 |
] ifFalse:[ |
|
517 |
state == #deleted ifTrue:[ |
|
518 |
(entry at:1) == $< ifTrue:[ |
|
519 |
useColors ifTrue:[ |
|
544
dea45065e7f1
use Text instead of ColoredListEntry
Claus Gittinger <cg@exept.de>
parents:
533
diff
changeset
|
520 |
l1 add:(Text string:(text1 at:idx1) foregroundColor:removedColor backgroundColor:removedBgColor ). |
183 | 521 |
] ifFalse:[ |
522 |
l1 add:(text1 at:idx1). |
|
523 |
]. |
|
524 |
idx1 := idx1 + 1. |
|
525 |
l2 add:nil |
|
526 |
] ifFalse:[ |
|
527 |
state := #initial. |
|
528 |
dIdx := dIdx - 1 |
|
529 |
] |
|
530 |
] |
|
531 |
"must be in finish otherwise" |
|
532 |
] |
|
533 |
] |
|
534 |
]. |
|
535 |
dIdx := dIdx + 1 |
|
536 |
]. |
|
537 |
[l1 size < l2 size] whileTrue:[ |
|
538 |
l1 add:''. |
|
539 |
]. |
|
540 |
[l2 size < l1 size] whileTrue:[ |
|
541 |
l2 add:''. |
|
542 |
]. |
|
2262
75d490e87d95
oops - care for diff -b space differences
Claus Gittinger <cg@exept.de>
parents:
2260
diff
changeset
|
543 |
|
75d490e87d95
oops - care for diff -b space differences
Claus Gittinger <cg@exept.de>
parents:
2260
diff
changeset
|
544 |
"/ 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
|
545 |
1 to:l1 size do:[:idx | |
75d490e87d95
oops - care for diff -b space differences
Claus Gittinger <cg@exept.de>
parents:
2260
diff
changeset
|
546 |
|line1 line2| |
75d490e87d95
oops - care for diff -b space differences
Claus Gittinger <cg@exept.de>
parents:
2260
diff
changeset
|
547 |
|
75d490e87d95
oops - care for diff -b space differences
Claus Gittinger <cg@exept.de>
parents:
2260
diff
changeset
|
548 |
line1 := l1 at:idx. |
75d490e87d95
oops - care for diff -b space differences
Claus Gittinger <cg@exept.de>
parents:
2260
diff
changeset
|
549 |
line2 := l2 at:idx. |
2268 | 550 |
(line1 notNil and:[line1 hasChangeOfEmphasis not]) ifTrue:[ |
551 |
(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
|
552 |
line1 withTabsExpanded withoutTrailingSeparators |
75d490e87d95
oops - care for diff -b space differences
Claus Gittinger <cg@exept.de>
parents:
2260
diff
changeset
|
553 |
~= line2 withTabsExpanded withoutTrailingSeparators |
75d490e87d95
oops - care for diff -b space differences
Claus Gittinger <cg@exept.de>
parents:
2260
diff
changeset
|
554 |
ifTrue:[ |
75d490e87d95
oops - care for diff -b space differences
Claus Gittinger <cg@exept.de>
parents:
2260
diff
changeset
|
555 |
line1 := Text string:line1 |
75d490e87d95
oops - care for diff -b space differences
Claus Gittinger <cg@exept.de>
parents:
2260
diff
changeset
|
556 |
foregroundColor:changedSpacesOnlyColor |
75d490e87d95
oops - care for diff -b space differences
Claus Gittinger <cg@exept.de>
parents:
2260
diff
changeset
|
557 |
backgroundColor:changedSpacesOnlyBgColor. |
75d490e87d95
oops - care for diff -b space differences
Claus Gittinger <cg@exept.de>
parents:
2260
diff
changeset
|
558 |
line2 := Text string:line2 |
75d490e87d95
oops - care for diff -b space differences
Claus Gittinger <cg@exept.de>
parents:
2260
diff
changeset
|
559 |
foregroundColor:changedSpacesOnlyColor |
75d490e87d95
oops - care for diff -b space differences
Claus Gittinger <cg@exept.de>
parents:
2260
diff
changeset
|
560 |
backgroundColor:changedSpacesOnlyBgColor. |
75d490e87d95
oops - care for diff -b space differences
Claus Gittinger <cg@exept.de>
parents:
2260
diff
changeset
|
561 |
l1 at:idx put:line1. |
75d490e87d95
oops - care for diff -b space differences
Claus Gittinger <cg@exept.de>
parents:
2260
diff
changeset
|
562 |
l2 at:idx put:line2. |
75d490e87d95
oops - care for diff -b space differences
Claus Gittinger <cg@exept.de>
parents:
2260
diff
changeset
|
563 |
] |
75d490e87d95
oops - care for diff -b space differences
Claus Gittinger <cg@exept.de>
parents:
2260
diff
changeset
|
564 |
] |
75d490e87d95
oops - care for diff -b space differences
Claus Gittinger <cg@exept.de>
parents:
2260
diff
changeset
|
565 |
] |
75d490e87d95
oops - care for diff -b space differences
Claus Gittinger <cg@exept.de>
parents:
2260
diff
changeset
|
566 |
]. |
75d490e87d95
oops - care for diff -b space differences
Claus Gittinger <cg@exept.de>
parents:
2260
diff
changeset
|
567 |
|
8934
7cc2affd9bb9
started to refactor into DiffListUtility
Claus Gittinger <cg@exept.de>
parents:
8676
diff
changeset
|
568 |
^ { l1. l2 } |
183 | 569 |
|
2260
2c093fe9ddb1
fix for win32 diff (which does not support -b option)
Claus Gittinger <cg@exept.de>
parents:
2246
diff
changeset
|
570 |
"Modified: / 13.7.1999 / 14:12:11 / cg" |
8934
7cc2affd9bb9
started to refactor into DiffListUtility
Claus Gittinger <cg@exept.de>
parents:
8676
diff
changeset
|
571 |
! |
7cc2affd9bb9
started to refactor into DiffListUtility
Claus Gittinger <cg@exept.de>
parents:
8676
diff
changeset
|
572 |
|
7cc2affd9bb9
started to refactor into DiffListUtility
Claus Gittinger <cg@exept.de>
parents:
8676
diff
changeset
|
573 |
updateListsFrom:text1 and:text2 diffs:diffList |
7cc2affd9bb9
started to refactor into DiffListUtility
Claus Gittinger <cg@exept.de>
parents:
8676
diff
changeset
|
574 |
"given the two texts in text1 and text2, and the diff-output in diffList, |
7cc2affd9bb9
started to refactor into DiffListUtility
Claus Gittinger <cg@exept.de>
parents:
8676
diff
changeset
|
575 |
update my views contents" |
7cc2affd9bb9
started to refactor into DiffListUtility
Claus Gittinger <cg@exept.de>
parents:
8676
diff
changeset
|
576 |
|
7cc2affd9bb9
started to refactor into DiffListUtility
Claus Gittinger <cg@exept.de>
parents:
8676
diff
changeset
|
577 |
|lists textView1 textView2| |
7cc2affd9bb9
started to refactor into DiffListUtility
Claus Gittinger <cg@exept.de>
parents:
8676
diff
changeset
|
578 |
|
7cc2affd9bb9
started to refactor into DiffListUtility
Claus Gittinger <cg@exept.de>
parents:
8676
diff
changeset
|
579 |
textView1 := textViews at:1. |
7cc2affd9bb9
started to refactor into DiffListUtility
Claus Gittinger <cg@exept.de>
parents:
8676
diff
changeset
|
580 |
textView2 := textViews at:2. |
7cc2affd9bb9
started to refactor into DiffListUtility
Claus Gittinger <cg@exept.de>
parents:
8676
diff
changeset
|
581 |
|
7cc2affd9bb9
started to refactor into DiffListUtility
Claus Gittinger <cg@exept.de>
parents:
8676
diff
changeset
|
582 |
lists := self processDiffList:diffList from:text1 and:text2. |
7cc2affd9bb9
started to refactor into DiffListUtility
Claus Gittinger <cg@exept.de>
parents:
8676
diff
changeset
|
583 |
|
7cc2affd9bb9
started to refactor into DiffListUtility
Claus Gittinger <cg@exept.de>
parents:
8676
diff
changeset
|
584 |
textView1 list:lists first. |
7cc2affd9bb9
started to refactor into DiffListUtility
Claus Gittinger <cg@exept.de>
parents:
8676
diff
changeset
|
585 |
textView2 list:lists second. |
183 | 586 |
! ! |
587 |
||
12405
76f9a872362b
Merged 3efd83b86c07 and 1206aff1f11 (branch default - CVS HEAD)
Jan Vrany <jan.vrany@fit.cvut.cz>
diff
changeset
|
588 |
|
242 | 589 |
!DiffTextView class methodsFor:'documentation'! |
590 |
||
591 |
version |
|
12383 | 592 |
^ '$Header: /cvs/stx/stx/libtool/DiffTextView.st,v 1.57 2013-02-01 15:13:02 cg Exp $' |
8934
7cc2affd9bb9
started to refactor into DiffListUtility
Claus Gittinger <cg@exept.de>
parents:
8676
diff
changeset
|
593 |
! |
7cc2affd9bb9
started to refactor into DiffListUtility
Claus Gittinger <cg@exept.de>
parents:
8676
diff
changeset
|
594 |
|
7cc2affd9bb9
started to refactor into DiffListUtility
Claus Gittinger <cg@exept.de>
parents:
8676
diff
changeset
|
595 |
version_CVS |
12383 | 596 |
^ '$Header: /cvs/stx/stx/libtool/DiffTextView.st,v 1.57 2013-02-01 15:13:02 cg Exp $' |
12128
a7ff7d66ee85
Improvements in LintHighlighter, few fixes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12125
diff
changeset
|
597 |
! |
a7ff7d66ee85
Improvements in LintHighlighter, few fixes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12125
diff
changeset
|
598 |
|
a7ff7d66ee85
Improvements in LintHighlighter, few fixes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12125
diff
changeset
|
599 |
version_SVN |
a7ff7d66ee85
Improvements in LintHighlighter, few fixes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12125
diff
changeset
|
600 |
^ '$Id: DiffTextView.st 7854 2012-01-30 17:49:41Z vranyj1 $' |
2268 | 601 |
! ! |
12383 | 602 |