mirror of
https://github.com/Maks1mS/bubbles.git
synced 2025-03-14 13:03:44 +03:00
Export pagination helpers
This commit is contained in:
parent
363c2522f2
commit
fc64be59d6
@ -63,13 +63,13 @@ func (m *Model) GetSliceBounds(length int) (start int, end int) {
|
|||||||
return start, end
|
return start, end
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *Model) prevPage() {
|
func (m *Model) PrevPage() {
|
||||||
if m.Page > 0 {
|
if m.Page > 0 {
|
||||||
m.Page--
|
m.Page--
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *Model) nextPage() {
|
func (m *Model) NextPage() {
|
||||||
if m.Page < m.TotalPages-1 {
|
if m.Page < m.TotalPages-1 {
|
||||||
m.Page++
|
m.Page++
|
||||||
}
|
}
|
||||||
@ -99,33 +99,33 @@ func Update(msg tea.Msg, m Model) (Model, tea.Cmd) {
|
|||||||
if m.UseLeftRightKeys {
|
if m.UseLeftRightKeys {
|
||||||
switch msg.String() {
|
switch msg.String() {
|
||||||
case "left":
|
case "left":
|
||||||
m.prevPage()
|
m.PrevPage()
|
||||||
case "right":
|
case "right":
|
||||||
m.nextPage()
|
m.NextPage()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if m.UseUpDownKeys {
|
if m.UseUpDownKeys {
|
||||||
switch msg.String() {
|
switch msg.String() {
|
||||||
case "up":
|
case "up":
|
||||||
m.prevPage()
|
m.PrevPage()
|
||||||
case "down":
|
case "down":
|
||||||
m.nextPage()
|
m.NextPage()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if m.UseHLKeys {
|
if m.UseHLKeys {
|
||||||
switch msg.String() {
|
switch msg.String() {
|
||||||
case "h":
|
case "h":
|
||||||
m.prevPage()
|
m.PrevPage()
|
||||||
case "l":
|
case "l":
|
||||||
m.nextPage()
|
m.NextPage()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if m.UseJKKeys {
|
if m.UseJKKeys {
|
||||||
switch msg.String() {
|
switch msg.String() {
|
||||||
case "j":
|
case "j":
|
||||||
m.prevPage()
|
m.PrevPage()
|
||||||
case "k":
|
case "k":
|
||||||
m.nextPage()
|
m.NextPage()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user