Skip to content

Commit a40200f

Browse files
committed
Merge ef17c7f
2 parents 3f35cec + ef17c7f commit a40200f

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

src/Brick/BrEditor.class.st

+11-9
Original file line numberDiff line numberDiff line change
@@ -36,17 +36,17 @@ BrEditor >> beReadOnlyWithoutSelection [
3636

3737
{ #category : #accessing }
3838
BrEditor >> computeVerticalScrollExtent [
39-
^ self lastVisibleSegment textEnd - self firstVisibleSegment textStart
39+
^ self lastVisibleSegment index - self firstVisibleSegment index
4040
]
4141

4242
{ #category : #accessing }
4343
BrEditor >> computeVerticalScrollOffset [
44-
^ self firstVisibleSegment textStart
44+
^ self firstVisibleSegment index
4545
]
4646

4747
{ #category : #accessing }
4848
BrEditor >> computeVerticalScrollRange [
49-
^ self text size
49+
^ self text lineCount
5050
]
5151

5252
{ #category : #'editor - accessing' }
@@ -165,12 +165,14 @@ BrEditor >> navigator [
165165

166166
{ #category : #'api - scrolling' }
167167
BrEditor >> onScrollBy: aWish [
168-
| position linesOnScreen |
169-
position := aWish delta y asInteger.
170-
linesOnScreen := self lastVisibleSegment index - self firstVisibleSegment index.
171-
position > self computeVerticalScrollExtent
172-
ifTrue: [ self scrollToPosition: self lastVisibleSegment index + linesOnScreen ]
173-
ifFalse: [ self scrollToPosition: self firstVisibleSegment index - linesOnScreen ]
168+
| position current |
169+
position := aWish delta y.
170+
position := position positive
171+
ifTrue: [ position roundUpTo: 1 ]
172+
ifFalse: [ position roundDownTo: 1 ].
173+
position asBeaconSignal emit.
174+
current := self firstVisibleSegment index.
175+
self scrollToPosition: position + current
174176
]
175177

176178
{ #category : #'editor - operations' }

0 commit comments

Comments
 (0)