#DOCUMENTATION by cg
class: TextView
removed: #characterEncoding:
comment/format in:
#fileOutContentsOn:compressTabs:encoding:
#selection
changed: #selectionChanged
--- a/TextView.st Mon Apr 11 14:47:21 2016 +0200
+++ b/TextView.st Tue Apr 12 16:18:12 2016 +0200
@@ -885,33 +885,6 @@
!TextView methodsFor:'accessing'!
-characterEncoding:encodingArg
- "define how the contents is encoded internally.
- This should normally never be required, as ST/X now assumes
- unicode (of which iso8859-1 is a subset) encoding.
- The possibility to change the characterEncoding is provided as
- a backward compatibility hook for programs which want to use
- another encoding internally."
-
- |encodingSymOrNil|
-
- encodingSymOrNil := encodingArg isNil
- ifTrue:[#'iso10646-1']
- ifFalse:[encodingArg asSymbol].
-
- characterEncoding ~~ encodingSymOrNil ifTrue:[
- "/ TODO: reencode contents if required.
-"/ (list size ~~ 0
-"/ and:[ list contains:[:line | line size > 0]]) ifTrue:[
-"/ (self confirm:(resources stringWithCRs:'Your text may need to be re-coded - this is not yet supported.\\Proceed ?'))
-"/ ifFalse:[^ self].
-"/ ].
- characterEncoding := encodingSymOrNil.
- ].
-
- "Modified (format): / 25-01-2012 / 00:28:27 / cg"
-!
-
characterPositionOfSelection
"return the character index of the first character in the selection.
Returns 0 if there is no selection."
@@ -2759,6 +2732,8 @@
self removeTrailingWhitespace.
+ "/ This is now obsolete, as we are always using unicode internally.
+ "/ so the following line should be changed to encoderToEncodeFrom:unicode to:xxx.
encoder := CharacterEncoder encoderToEncodeFrom:characterEncoding into:encodingSymOrNil.
encoder isNullEncoder ifTrue:[
(list contains:[:lineOrNil|
@@ -4993,6 +4968,8 @@
selectionStartLine isNil ifTrue:[^ nil].
sel := self textFromLine:selectionStartLine col:(selectionStartCol max:1) toLine:selectionEndLine col:selectionEndCol.
sel notEmptyOrNil ifTrue:[
+ "/ this is rubbish; we are now always using unicode internally
+ "/ any many more conversions would be needed at many places...
(characterEncoding ? #'iso10646-1' "eg unicode") ~~ #'iso10646-1' ifTrue:[
sel := sel encodeFrom:characterEncoding into:#'iso10646-1'
].
@@ -5013,9 +4990,12 @@
!
selectionChanged
- "can be redefined for notification or special actions"
-
- "Modified: / 17-04-2012 / 20:59:49 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "can be redefined for notification or special actions.
+ If you do, do not forget to do a super selectionChanged"
+
+ self changed:#selection.
+"/ self selectionHolder value:{ selectionStartCol @ selectionStartLine .
+"/ selectionEndCol @ selectionEndLine }
!
selectionEndCol