--- a/TextView.st Tue Feb 10 18:05:35 2004 +0100
+++ b/TextView.st Tue Feb 10 18:06:01 2004 +0100
@@ -636,6 +636,17 @@
!TextView methodsFor:'accessing'!
+characterEncoding:encodingSymOrNil
+ "define how the contents is encoded internally.
+ For now, this should be the same encoding as my fonts encoding (otherwise, mappings would
+ occur when drawing).
+ This is (currently) only passed down from the fileBrowser,
+ and required when japanese/chinese/korean text is edited.
+ (encoding is something like #'iso8859-5' #euc, #sjis, #jis7, #gb, #big5 or #ksc)"
+
+ characterEncoding := encodingSymOrNil
+!
+
characterPositionOfSelection
"return the character index of the first character in the selection.
Returns 0 if there is no selection."
@@ -686,8 +697,8 @@
"define how the contents should be encoded when saved
via the 'save / save as' dialog.
This is (currently) only passed down from the fileBrowser,
- and required when japanese/chines/korean text is edited.
- (encoding is one of #euc, #sjis, #jis7, #gb, #big5 or #ksc)"
+ and required when japanese/chinese/korean text is edited.
+ (encoding is something like #'iso8859-5' #euc, #sjis, #jis7, #gb, #big5 or #ksc)"
externalEncoding := encodingSymOrNil
!
@@ -3621,8 +3632,14 @@
If the selection ends in a full line, the last entry in the returned
collection will be an empty string."
+ |sel|
+
selectionStartLine isNil ifTrue:[^ nil].
- ^ self textFromLine:selectionStartLine col:selectionStartCol toLine:selectionEndLine col:selectionEndCol
+ sel := self textFromLine:selectionStartLine col:selectionStartCol toLine:selectionEndLine col:selectionEndCol.
+ characterEncoding ~~ #'iso8859-1' ifTrue:[
+ sel := sel encodeFrom:characterEncoding into:#'unicode'
+ ].
+ ^ sel
"Modified: / 22.2.2000 / 23:54:54 / cg"
!
@@ -3714,7 +3731,7 @@
!TextView class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libwidg/TextView.st,v 1.224 2004-02-10 09:32:45 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libwidg/TextView.st,v 1.225 2004-02-10 17:05:01 cg Exp $'
! !
TextView initialize!