mirror of
https://github.com/Maks1mS/bubbles.git
synced 2025-10-09 22:08:07 +03:00
feat(table): add function to set cursor position (#219)
This commit is contained in:
@@ -291,6 +291,12 @@ func (m Model) Cursor() int {
|
|||||||
return m.cursor
|
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.
|
// MoveUp moves the selection up by any number of row.
|
||||||
// It can not go above the first row.
|
// It can not go above the first row.
|
||||||
func (m *Model) MoveUp(n int) {
|
func (m *Model) MoveUp(n int) {
|
||||||
|
Reference in New Issue
Block a user