Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Go install made possible #112

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
reset cursor on page change or category change
  • Loading branch information
f01c33 committed May 11, 2024
commit bfdc2e1f15d6968f5de694209ebbe562438d1c29
14 changes: 3 additions & 11 deletions bubble/list/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -665,7 +665,7 @@ func (m *Model) updateHelpScreen(msg tea.Msg) (*Model, tea.Cmd) {
}

func (m *Model) updateCursor() {
m.cursor = min(m.cursor, m.Paginator.ItemsOnPage(len(m.VisibleItems()))-1)
m.cursor = 0
}

func (m *Model) categoryHasStories(cat int) bool {
Expand All @@ -674,19 +674,15 @@ func (m *Model) categoryHasStories(cat int) bool {

func (m *Model) changeToNextCategory() {
m.cat.Next(m.favorites.HasItems())
currentCategory := m.cat.GetCurrentCategory(m.favorites.HasItems())

m.Paginator.Page = 0
m.cursor = min(m.cursor, len(m.items[currentCategory])-1)
m.cursor = 0
m.updatePagination()
}

func (m *Model) changeToPrevCategory() {
m.cat.Prev(m.favorites.HasItems())
currentCategory := m.cat.GetCurrentCategory(m.favorites.HasItems())

m.Paginator.Page = 0
m.cursor = min(m.cursor, len(m.items[currentCategory])-1)
m.cursor = 0
m.updatePagination()
}

Expand Down Expand Up @@ -802,8 +798,6 @@ func (m *Model) handleBrowsing(msg tea.Msg) tea.Cmd {
m.SetDisabledInput(true)
startSpinnerCmd := m.StartSpinner()

//m.categoryToDisplay = nextCat

changeCatCmd := func() tea.Msg {
return message.FetchAndChangeToCategory{Index: nextIndex, Category: nextCat, Cursor: m.cursor}
}
Expand All @@ -826,8 +820,6 @@ func (m *Model) handleBrowsing(msg tea.Msg) tea.Cmd {
m.SetDisabledInput(true)
startSpinnerCmd := m.StartSpinner()

//m.categoryToDisplay = prevCat

changeCatCmd := func() tea.Msg {
return message.FetchAndChangeToCategory{Index: prevIndex, Category: prevCat, Cursor: m.cursor}
}
Expand Down