#BUGFIX by stefan
authorStefan Vogel <sv@exept.de>
Tue, 28 Apr 2020 14:37:04 +0200
changeset 25369 b3d232a613c9
parent 25368 4450c5cecd9c
child 25370 c417f7edaec1
#BUGFIX by stefan class: OrderedCollection class added: #newWithCapacity: changed: #with: (send #newWithCapacity: instead of #new:) Fix TextView selection bug, where an empty line was always prepended to the selection (bug has been introduced in last version).
OrderedCollection.st
--- a/OrderedCollection.st	Tue Apr 28 11:50:16 2020 +0200
+++ b/OrderedCollection.st	Tue Apr 28 14:37:04 2020 +0200
@@ -313,20 +313,31 @@
     "
 !
 
+newWithCapacity:size
+    "create a new, empty OrderedCollection with a preallocated physical size.
+     Different from #new: for the StringCollection subclass, which allocates size empty lines."
+
+    ^ self new:size
+
+    "Created: / 28-04-2020 / 14:32:27 / Stefan Vogel"
+!
+
 with:anElement
     "redefined for performance"
 
     |newColl|
 
-    newColl := self new:1.
+    newColl := self newWithCapacity:1.
     newColl add:anElement.
     ^ newColl
 
     "
-     OrderedCollection with:1234
+     OrderedCollection with:1234.
+     StringCollection with:'Hello'.
     "
 
     "Created: / 24-04-2020 / 11:49:58 / cg"
+    "Modified (comment): / 28-04-2020 / 14:29:32 / Stefan Vogel"
 ! !