DiffTextView.st
changeset 69 0d6acfdae045
parent 52 7b48409ae088
child 110 570a38362ae1
--- a/DiffTextView.st	Sun Feb 19 16:54:18 1995 +0100
+++ b/DiffTextView.st	Wed Feb 22 02:24:46 1995 +0100
@@ -21,7 +21,7 @@
 COPYRIGHT (c) 1994 by Claus Gittinger
 	      All Rights Reserved
 
-$Header: /cvs/stx/stx/libtool/DiffTextView.st,v 1.4 1994-11-17 14:46:45 claus Exp $
+$Header: /cvs/stx/stx/libtool/DiffTextView.st,v 1.5 1995-02-22 01:24:40 claus Exp $
 '!
 
 !DiffTextView class methodsFor:'documentation'!
@@ -42,7 +42,7 @@
 
 version
 "
-$Header: /cvs/stx/stx/libtool/DiffTextView.st,v 1.4 1994-11-17 14:46:45 claus Exp $
+$Header: /cvs/stx/stx/libtool/DiffTextView.st,v 1.5 1995-02-22 01:24:40 claus Exp $
 "
 !
 
@@ -69,6 +69,9 @@
 !DiffTextView methodsFor:'private'!
 
 updateListsFrom:text1 and:text2 diffs:diffList
+    "given the two texts in text1 and text2, and the diff-output in diffList,
+     update my views contents"
+
     |idx1 idx2 dIdx dEnd state s nr1 nr2 nr3 op entry c l1 l2 any delta|
 
     l1 := OrderedCollection new.
@@ -233,24 +236,23 @@
 !DiffTextView methodsFor:'accessing'!
 
 text1:t1 text2:t2
-    |tmpName1 tmpName2 stream line text1 text2 diffList|
+    |tmpFile1 tmpFile2 Name1 tmpName2 stream line text1 text2 diffList pidString|
 
-    text1 := t1 asText.
-    text2 := t2 asText.
+    text1 := t1 asStringCollection.
+    text2 := t2 asStringCollection.
 
     "
      save them texts in two temporary files ...
     "
-    tmpName1 := '/tmp/sta_' , OperatingSystem getProcessId printString , '.tmp'.
-    tmpName2 := '/tmp/stb_' , OperatingSystem getProcessId printString , '.tmp'.
-
-    stream := tmpName1 asFilename writeStream.
+    tmpFile1 := Filename newTemporary.
+    stream := tmpFile1 writeStream.
     text1 do:[:line |
 	stream nextPutAll:line; cr
     ].
     stream close.
 
-    stream := tmpName2 asFilename writeStream.
+    tmpFile2 := Filename newTemporary.
+    stream := tmpFile2 writeStream.
     text2 do:[:line |
 	stream nextPutAll:line; cr
     ].
@@ -261,7 +263,7 @@
     "
     stream := PipeStream 
 		readingFrom:self class diffCommand , ' ' , 
-			    tmpName1 , ' ' , tmpName2.
+			    tmpFile1 asString, ' ' , tmpFile2 asString.
     stream isNil ifTrue:[
 	self error:'cannot execute diff'.
 	text1 := text2 := nil.
@@ -274,8 +276,8 @@
 	stream close.
     ].
 
-    tmpName1 asFilename delete.
-    tmpName2 asFilename delete.
+    tmpFile1 delete.
+    tmpFile2 delete.
 
     self updateListsFrom:text1 and:text2 diffs:diffList
 
@@ -308,6 +310,6 @@
 
      v := DiffTextView new.
      v text1:t1 text2:t2.
-     v
+     v open
     "
 ! !