Commit 21baf6f4e0

21baf6f4e00a4ead29b197b4f078b332fd2d2be2

parent: bd7eed4acb

Unsigned

Wraient <wraient.911@gmail.com> · 2025-07-23 19:10 UTC

Fix: Next episode prompt fr fr frrrrr

Layout: unified · split

internal/curd.go +13 −1
@@ -1365,7 +1365,7 @@ func NextEpisodePrompt(userCurdConfig *CurdConfig) {
13651365 // Create options for the selection
13661366 options := []SelectionOption{
13671367 {Key: "yes", Label: "Yes, start next episode"},
1368 // "no": "No, quit",
1368 // {Key: "-1", Label: "No, quit"},
13691369 }
13701370
13711371 // Use DynamicSelect for both CLI and Rofi modes
@@ -1375,6 +1375,8 @@ func NextEpisodePrompt(userCurdConfig *CurdConfig) {
13751375 ExitCurd(err)
13761376 }
13771377
1378 Log(fmt.Sprintf("User Selected Key: '%s', Label: '%s'", selectedOption.Key, selectedOption.Label))
1379
13781380 if selectedOption.Key == "-1" {
13791381 // User selected to quit
13801382 fmt.Print("\r\033[K") // Carriage return and clear line
@@ -1384,6 +1386,16 @@ func NextEpisodePrompt(userCurdConfig *CurdConfig) {
13841386 return
13851387 }
13861388
1389 if selectedOption.Key != "yes" {
1390 // User selected something other than yes (shouldn't happen, but safety check)
1391 Log(fmt.Sprintf("Unexpected selection key: %s", selectedOption.Key))
1392 fmt.Print("\r\033[K") // Carriage return and clear line
1393 ExitMPV(anime.Ep.Player.SocketPath)
1394 CurdOut("Exiting without starting next episode")
1395 ExitCurd(nil)
1396 return
1397 }
1398
13871399 // If yes, start the next episode
13881400 prevEpisode := anime.Ep.Number
13891401 anime.Ep.Number++
internal/selection_menu.go +7 −3
@@ -81,9 +81,8 @@ func (m *Model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
8181 case tea.KeyMsg:
8282 switch msg.String() {
8383 case "ctrl+c":
84 // Return quit selection option instead of quitting the program
85 m.filteredKeys[m.selected] = SelectionOption{"quit", "-1"}
86 return m, tea.Quit // Properly exit the program
84 // Return quit selection option directly
85 return m, tea.Quit
8786 case "backspace":
8887 if len(m.filter) > 0 {
8988 m.filter = m.filter[:len(m.filter)-1]
@@ -463,6 +462,11 @@ func DynamicSelect(options []SelectionOption) (SelectionOption, error) {
463462 return SelectionOption{}, fmt.Errorf("unexpected model type")
464463 }
465464
465 // Check if the program was quit with Ctrl+C
466 if err != nil {
467 return SelectionOption{Key: "-1", Label: "Quit"}, nil
468 }
469
466470 if finalSelectionModel.selected < len(finalSelectionModel.filteredKeys) {
467471 return finalSelectionModel.filteredKeys[finalSelectionModel.selected], nil
468472 }