#FEATURE by cg
class: EditTextView
changed: #cursorDown:
same hook mechanism as in cursorUP.
--- 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"