ListView.st
changeset 2158 1fbe3297506f
parent 2133 47a23fdfc83f
child 2180 d208b77444a7
--- a/ListView.st	Wed Feb 23 11:27:45 2000 +0100
+++ b/ListView.st	Wed Feb 23 11:29:02 2000 +0100
@@ -1086,6 +1086,40 @@
     "Created: 7.1.1997 / 19:58:43 / cg"
 !
 
+textFromLine:startLine col:startCol toLine:endLine col:endCol
+    "return some text as a collection of (line-)strings."
+
+    |text sz index last|
+
+    (startLine == endLine) ifTrue:[
+        "part of a line"
+        ^ StringCollection with:(self listAt:startLine
+                                        from:startCol
+                                          to:endCol)
+    ].
+    sz := endLine - startLine + 1.
+    text := StringCollection new:sz.
+
+    "get 1st and last (possibly) partial lines"
+    text at:1 put:(self listAt:startLine from:startCol).
+    endCol == 0 ifTrue:[
+        last := ''
+    ] ifFalse:[
+        last := self listAt:endLine to:endCol.
+    ].
+    text at:sz put:last.
+
+    "get bulk of text"
+    index := 2.
+    (startLine + 1) to:(endLine - 1) do:[:lineNr |
+        text at:index put:(self listAt:lineNr).
+        index := index + 1
+    ].
+    ^ text
+
+    "Created: / 22.2.2000 / 23:53:06 / cg"
+!
+
 withoutRedrawAt:index put:aString
     "change a line without redisplay and WITHOUT any sizeChange notifications"
 
@@ -3998,5 +4032,5 @@
 !ListView class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg/ListView.st,v 1.219 2000-02-09 19:24:51 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg/ListView.st,v 1.220 2000-02-23 10:29:02 cg Exp $'
 ! !