mirror of
https://github.com/zoriya/bubbles.git
synced 2026-08-16 01:43:21 +00:00
feat(textarea): add ScrollYOffset and ScrollPosition methods
Signed-off-by: Liam Stanley <liam@liam.sh>
This commit is contained in:
committed by
Christian Rocha
parent
601216f68e
commit
c690ea5e0f
+13
-1
@@ -591,11 +591,23 @@ func (m *Model) LineCount() int {
|
||||
return len(m.value)
|
||||
}
|
||||
|
||||
// Line returns the line position.
|
||||
// Line returns the row position of the cursor.
|
||||
func (m Model) Line() int {
|
||||
return m.row
|
||||
}
|
||||
|
||||
// ScrollYOffset returns the Y offset (top row) index of the current view, which
|
||||
// can be used to calculate the current scroll position.
|
||||
func (m Model) ScrollYOffset() int {
|
||||
return m.viewport.YOffset()
|
||||
}
|
||||
|
||||
// ScrollPercent returns the amount of the textarea that is currently scrolled
|
||||
// through, clamped between 0 and 1.
|
||||
func (m Model) ScrollPercent() float64 {
|
||||
return m.viewport.ScrollPercent()
|
||||
}
|
||||
|
||||
// CursorDown moves the cursor down by one line.
|
||||
// Returns whether or not the cursor blink should be reset.
|
||||
func (m *Model) CursorDown() {
|
||||
|
||||
Reference in New Issue
Block a user