mirror of
https://github.com/Maks1mS/bubbles.git
synced 2024-12-23 14:22:58 +03:00
feat(table): add function to set cursor position (#219)
This commit is contained in:
parent
d44e242f37
commit
afd6f58c18
@ -291,6 +291,12 @@ func (m Model) Cursor() int {
|
||||
return m.cursor
|
||||
}
|
||||
|
||||
// SetCursor sets the cursor position in the table.
|
||||
func (m *Model) SetCursor(n int) {
|
||||
m.cursor = clamp(n, 0, len(m.rows)-1)
|
||||
m.UpdateViewport()
|
||||
}
|
||||
|
||||
// MoveUp moves the selection up by any number of row.
|
||||
// It can not go above the first row.
|
||||
func (m *Model) MoveUp(n int) {
|
||||
|
Loading…
Reference in New Issue
Block a user