Skip to content

Commit

Permalink
feature: #76, clarify search results
Browse files Browse the repository at this point in the history
  • Loading branch information
xxxserxxx committed Oct 28, 2024
1 parent 4a8428b commit 6c0f4dd
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions page_search.go
Original file line number Diff line number Diff line change
Expand Up @@ -218,15 +218,13 @@ func (s *SearchPage) search(search chan string) {
artOff = 0
albOff = 0
songOff = 0
s.logger.Printf("searching for %q [%d, %d, %d]", query, artOff, albOff, songOff)
for len(more) > 0 {
<-more
}
if query == "" {
continue
}
case <-more:
s.logger.Printf("fetching more %q [%d, %d, %d]", query, artOff, albOff, songOff)
}
res, err := s.ui.connection.Search(query, artOff, albOff, songOff)
if err != nil {
Expand Down Expand Up @@ -265,6 +263,10 @@ func (s *SearchPage) search(search chan string) {
s.songList.Box.SetTitle(fmt.Sprintf(" song matches (%d) ", len(s.songs)))
})

// Only do this the one time, to prevent loops from stealing the user's focus
if artOff == 0 && albOff == 0 && songOff == 0 {
s.aproposFocus()
}
artOff += len(res.SearchResults.Artist)
albOff += len(res.SearchResults.Album)
songOff += len(res.SearchResults.Song)
Expand Down

0 comments on commit 6c0f4dd

Please sign in to comment.