diff -r d901436411af -r 6a68adba9c33 DiffTextView.st --- a/DiffTextView.st Fri Jan 30 00:18:53 1998 +0100 +++ b/DiffTextView.st Fri Jan 30 12:24:57 1998 +0100 @@ -14,7 +14,7 @@ instanceVariableNames:'useColors showSeparators addedColor addedBgColor removedColor removedBgColor changedColor changedBgColor changedSpacesOnlyColor changedSpacesOnlyBgColor diffLineNumbers' - classVariableNames:'' + classVariableNames:'DiffCommandTemplate' poolDictionaries:'' category:'Views-Text' ! @@ -90,17 +90,38 @@ !DiffTextView class methodsFor:'defaults'! diffCommand - "return the diff-command (with arguments)" + "return the diff-command (with argument placeHolders)" + + OperatingSystem isMSDOSlike ifTrue:[ + ^ DiffCommandTemplate ? 'diff %1 %2' + ]. + + ^ DiffCommandTemplate ? 'diff -b %1 %2' + + "Modified: / 30.1.1998 / 12:12:49 / cg" +! - ^ 'diff -b' +diffCommandTemplate:aCommandTemplateString + "set the diff-command template" + + OperatingSystem isMSDOSlike ifTrue:[ + ^ DiffCommandTemplate ? 'diff %1 %2' + ]. + + ^ DiffCommandTemplate ? 'diff -b %1 %2' + + "Modified: / 30.1.1998 / 12:10:34 / cg" + "Created: / 30.1.1998 / 12:12:37 / cg" ! ! !DiffTextView methodsFor:'accessing'! text1:t1 text2:t2 - "set the two texts which are to be diffed" + "set the two texts which are to be diffed; + execute DiffCommand and update the two textViews." - |tmpFile1 tmpFile2 name1 tmpName2 stream line text1 text2 diffList pidString| + |tmpFile1 tmpFile2 name1 tmpName2 stream line + text1 text2 diffList pidString diffCmd| text1 := t1 asStringCollection. text2 := t2 asStringCollection. @@ -125,9 +146,11 @@ " start diff on it ... " - stream := PipeStream - readingFrom:self class diffCommand , ' ' , - tmpFile1 asString, ' ' , tmpFile2 asString. + diffCmd := self class diffCommand + bindWith:tmpFile1 asString + with:tmpFile2 asString. + + stream := PipeStream readingFrom:diffCmd. stream isNil ifTrue:[ self error:'cannot execute diff'. text1 := text2 := nil. @@ -177,7 +200,7 @@ v open " - "Modified: 25.4.1996 / 13:33:52 / cg" + "Modified: / 30.1.1998 / 12:12:13 / cg" ! ! !DiffTextView methodsFor:'initialization'! @@ -451,4 +474,4 @@ !DiffTextView class methodsFor:'documentation'! version -^ '$Header: /cvs/stx/stx/libtool/DiffTextView.st,v 1.21 1997-08-07 10:54:51 cg Exp $'! ! +^ '$Header: /cvs/stx/stx/libtool/DiffTextView.st,v 1.22 1998-01-30 11:24:57 cg Exp $'! !