Merge jv
authorJan Vrany <jan.vrany@fit.cvut.cz>
Wed, 13 Apr 2016 09:24:13 +0100
branchjv
changeset 5660 d6040b3f1a37
parent 5659 3f63a8393f8e (current diff)
parent 5658 bfc80e89fb1a (diff)
child 5665 a28ccea0dc36
Merge
SelectionInListView.st
TextView.st
--- a/SelectionInListView.st	Sat Apr 09 08:57:26 2016 +0100
+++ b/SelectionInListView.st	Wed Apr 13 09:24:13 2016 +0100
@@ -3600,7 +3600,11 @@
     ].
 
     newSelection := selectionAtClickTime copy.
-    newSelection isNil ifTrue:[newSelection := OrderedCollection new].
+    newSelection isNil ifTrue:[
+        newSelection := OrderedCollection new.
+    ] ifFalse:[
+        newSelection := newSelection asOrderedCollection.
+    ].    
 
     "/ compute new selection
     delta  := (clickLine < movedLine) ifTrue:[1] ifFalse:[-1].
--- a/TextView.st	Sat Apr 09 08:57:26 2016 +0100
+++ b/TextView.st	Wed Apr 13 09:24:13 2016 +0100
@@ -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].
-
-    gc 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].
-"/        ].
-	super 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:gc characterEncoding into:encodingSymOrNil.
     encoder isNullEncoder ifTrue:[
 	(list contains:[:lineOrNil|
@@ -5000,8 +4975,10 @@
     selectionStartLine isNil ifTrue:[^ nil].
     sel := self textFromLine:selectionStartLine col:(selectionStartCol max:1) toLine:selectionEndLine col:selectionEndCol.
     sel notEmptyOrNil ifTrue:[
-	(gc characterEncoding ? #'iso10646-1' "eg unicode") ~~ #'iso10646-1' ifTrue:[
-	    sel := sel encodeFrom:gc characterEncoding into:#'iso10646-1'
+        "/ this is rubbish; we are now always using unicode internally
+        "/ any many more conversions would be needed at many places...
+        (gc characterEncoding ? #'iso10646-1' "eg unicode") ~~ #'iso10646-1' ifTrue:[
+            sel := sel encodeFrom:gc characterEncoding into:#'iso10646-1'
         ].
     ].
     ^ sel
@@ -5020,9 +4997,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