--- a/EditTextView.st Fri Aug 12 06:45:24 2016 +0200
+++ b/EditTextView.st Mon Aug 15 17:31:44 2016 +0100
@@ -6415,6 +6415,36 @@
and:t2 label:'Clipboard'
!
+compareWithFile
+ "compare the selection or the whole text against the contents of a file"
+
+ |fn t1 t2|
+
+ fn := Dialog requestFileName:'Compare against file:' default:defaultFileNameForFileDialog.
+ fn isEmptyOrNil ifTrue:[^ self].
+
+ t2 := fn asFilename contentsOfEntireFile.
+ t2 isEmptyOrNil ifTrue:[
+ Dialog information:'File is empty.'.
+ ^ self.
+ ].
+
+ self hasSelection ifTrue:[
+ t1 := self selectionAsString.
+ ] ifFalse:[
+ t1 := self contents asString
+ ].
+ t1 := t1 string.
+
+ t1 = t2 ifTrue:[
+ Dialog information:'Same contents.'.
+ ^ self.
+ ].
+ DiffTextView
+ openOn:t1 label:'Editor'
+ and:t2 label:'File'
+!
+
copySelection
"copy contents into smalltalk copybuffer.
Redefined to move the (currently hidden cursor) to the selection's end"
@@ -6608,6 +6638,7 @@
('Builtin Spell Check' internalSpellingSuggestion )
('Translate' babelFishTranslate )
('Compare with Clipboard...' compareWithClipboard )
+ ('Compare with File...' compareWithFile )
).
Smalltalk isStandAloneApp ifFalse:[
--- a/SelectionInListView.st Fri Aug 12 06:45:24 2016 +0200
+++ b/SelectionInListView.st Mon Aug 15 17:31:44 2016 +0100
@@ -1,3 +1,5 @@
+"{ Encoding: utf8 }"
+
"
COPYRIGHT (c) 1989 by Claus Gittinger
All Rights Reserved
@@ -2219,6 +2221,8 @@
!
invalidateSelection
+ "invalidate (force async redraw) the current selection"
+
shown ifTrue:[
self selectionDo:[:lineNr| self invalidateLine:lineNr ].
].