#FEATURE by cg
authorClaus Gittinger <cg@exept.de>
Tue, 13 Sep 2016 14:50:50 +0200
changeset 5857 006deb952a1e
parent 5856 a4d4442497d6
child 5858 f281506fb025
#FEATURE by cg class: EditTextView changed: #cursorDown: same hook mechanism as in cursorUP.
EditTextView.st
--- a/EditTextView.st	Tue Sep 13 14:46:47 2016 +0200
+++ b/EditTextView.st	Tue Sep 13 14:50:50 2016 +0200
@@ -1704,33 +1704,44 @@
 cursorDown:n
     "move cursor down by n lines; scroll if at end of visible text"
 
-    |wasOn nv nL|
+    |inLastLine wasOn nv nL cursorColBefore|
 
     (nL := cursorLine) isNil ifTrue:[
-	nL := firstLineShown
+        nL := firstLineShown
+    ].
+
+    inLastLine := (nL == list size).
+    
+    inLastLine ifTrue:[
+        |scrollBelowBottomHandler|
+
+        cursorColBefore := cursorCol.
+        (scrollBelowBottomHandler := self getAttribute:#scrollBelowBottomHandler) notNil ifTrue:[
+            nL := scrollBelowBottomHandler value:(nL + n)
+        ].    
     ].
 
     self st80EditMode ifTrue:[
-	nL == list size ifTrue:[
-	    wasOn := self hideCursor.
-	    self setValidatedCursorLine:(list size) col:(self listAt:list size) size + 1.
-	    self makeCursorVisibleAndShowCursor:wasOn.
-	    self beep.
-	    ^ self.
-	]
+        nL == list size ifTrue:[
+            wasOn := self hideCursor.
+            self setValidatedCursorLine:nL col:(self listAt:nL) size + 1.
+            self makeCursorVisibleAndShowCursor:wasOn.
+            self beep.
+            ^ self.
+        ]
     ].
 
     cursorVisibleLine notNil ifTrue:[
-	wasOn := self hideCursor.
-	nv := cursorVisibleLine + n - 1.
-	(nv >= nFullLinesShown) ifTrue:[
-	    self scrollDown:(nv - nFullLinesShown + 1)
-	].
-	self setValidatedCursorLine:(cursorLine + n) col:cursorCol.
-	self makeCursorVisibleAndShowCursor:wasOn.
+        wasOn := self hideCursor.
+        nv := cursorVisibleLine + n - 1.
+        (nv >= nFullLinesShown) ifTrue:[
+            self scrollDown:(nv - nFullLinesShown + 1)
+        ].
+        self setValidatedCursorLine:(cursorLine + n) col:(cursorColBefore ? cursorCol).
+        self makeCursorVisibleAndShowCursor:wasOn.
     ] ifFalse:[
-	self setValidatedCursorLine:(nL + n) col:cursorCol.
-	self makeCursorVisible.
+        self setValidatedCursorLine:(nL + n) col:(cursorColBefore ? cursorCol).
+        self makeCursorVisible.
     ].
 
     "Modified: / 10.6.1998 / 16:59:17 / cg"