adjust h-scroll offset if only part is visible,
authorClaus Gittinger <cg@exept.de>
Sat, 20 Feb 1999 12:46:36 +0100
changeset 1751 f29c3312beaf
parent 1750 d87cc464fde2
child 1752 f1e400f163ad
adjust h-scroll offset if only part is visible, to make the most possible part of the input visible.
EditField.st
--- a/EditField.st	Fri Feb 19 19:11:58 1999 +0100
+++ b/EditField.st	Sat Feb 20 12:46:36 1999 +0100
@@ -1957,16 +1957,32 @@
 
 !EditField methodsFor:'scrolling'!
 
-makeColVisible:col inLine:line
+makeColVisible:col inLine:lineNr
     "dont scroll for the cursor, if its behond the text and a lengthLimit
      is present."
 
-    lengthLimit notNil ifTrue:[
-	(col == cursorCol and:[col > lengthLimit]) ifTrue:[
-	    ^ super makeColVisible:lengthLimit inLine:line
-	]
+    |wText|
+
+    (lengthLimit notNil 
+    and:[col == cursorCol 
+    and:[col > lengthLimit]]) ifTrue:[
+        super makeColVisible:lengthLimit inLine:lineNr
+    ] ifFalse:[
+        super makeColVisible:col inLine:lineNr
     ].
-    ^ super makeColVisible:col inLine:line
+
+    "/ new:
+    "/ care to make the most possible visible
+    leftOffset > 0 ifTrue:[
+        wText := self widthOfLine:lineNr.
+        wText <= self innerWidth ifTrue:[
+            self scrollHorizontalTo:0
+        ] ifFalse:[
+            wText < (leftOffset+self innerWidth) ifTrue:[
+                self scrollHorizontalTo:(wText - self innerWidth)
+            ]
+        ]
+    ]
 
     "Modified: 6.9.1995 / 13:57:53 / claus"
 ! !
@@ -2006,5 +2022,5 @@
 !EditField class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg/EditField.st,v 1.115 1999-02-09 18:28:22 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg/EditField.st,v 1.116 1999-02-20 11:46:36 cg Exp $'
 ! !