ListView.st
changeset 919 f74955edb307
parent 911 22a930d19a9b
child 940 e53f681448f0
--- a/ListView.st	Tue Jan 07 20:32:06 1997 +0100
+++ b/ListView.st	Tue Jan 07 20:33:21 1997 +0100
@@ -839,6 +839,33 @@
     ^ list size.
 !
 
+stringAtLine:lineNr from:col1 to:col2
+    "return the substring starting at physical line/col1, up-to and
+     including col2. 
+     The lineNr and colNr arguments start at 1, for the top-left character.
+     Fills the string with space characters at the right.
+     (i.e. behond the end of the line or below the last line)"
+
+    |line len s|
+
+    len := col2 - col1 + 1.
+    list notNil ifTrue:[
+        line := self listAt:lineNr.
+        line notNil ifTrue:[
+            (line size >= col1) ifTrue:[
+                s := line copyFrom:col1.
+                s size < len ifTrue:[
+                    ^ s paddedTo:len
+                ].
+                ^ s copyTo:len
+            ]
+        ]
+    ].
+    ^ String new:len withAll:Character space
+
+    "Created: 7.1.1997 / 19:58:43 / cg"
+!
+
 withoutRedrawAt:index put:aString
     "change a line without redisplay"
 
@@ -3447,5 +3474,5 @@
 !ListView class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg/ListView.st,v 1.114 1997-01-03 02:23:33 stefan Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg/ListView.st,v 1.115 1997-01-07 19:33:21 cg Exp $'
 ! !