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) {
1365 // Create options for the selection 1365 // Create options for the selection
1366 options := []SelectionOption{ 1366 options := []SelectionOption{
1367 {Key: "yes", Label: "Yes, start next episode"}, 1367 {Key: "yes", Label: "Yes, start next episode"},
1368 // "no": "No, quit", 1368 // {Key: "-1", Label: "No, quit"},
1369 } 1369 }
1370 1370
1371 // Use DynamicSelect for both CLI and Rofi modes 1371 // Use DynamicSelect for both CLI and Rofi modes
@@ -1375,6 +1375,8 @@ func NextEpisodePrompt(userCurdConfig *CurdConfig) {
1375 ExitCurd(err) 1375 ExitCurd(err)
1376 } 1376 }
1377 1377
1378 Log(fmt.Sprintf("User Selected Key: '%s', Label: '%s'", selectedOption.Key, selectedOption.Label))
1379
1378 if selectedOption.Key == "-1" { 1380 if selectedOption.Key == "-1" {
1379 // User selected to quit 1381 // User selected to quit
1380 fmt.Print("\r\033[K") // Carriage return and clear line 1382 fmt.Print("\r\033[K") // Carriage return and clear line
@@ -1384,6 +1386,16 @@ func NextEpisodePrompt(userCurdConfig *CurdConfig) {
1384 return 1386 return
1385 } 1387 }
1386 1388
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
1387 // If yes, start the next episode 1399 // If yes, start the next episode
1388 prevEpisode := anime.Ep.Number 1400 prevEpisode := anime.Ep.Number
1389 anime.Ep.Number++ 1401 anime.Ep.Number++
internal/selection_menu.go +7 −3
@@ -81,9 +81,8 @@ func (m *Model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
81 case tea.KeyMsg: 81 case tea.KeyMsg:
82 switch msg.String() { 82 switch msg.String() {
83 case "ctrl+c": 83 case "ctrl+c":
84 // Return quit selection option instead of quitting the program 84 // Return quit selection option directly
85 m.filteredKeys[m.selected] = SelectionOption{"quit", "-1"} 85 return m, tea.Quit
86 return m, tea.Quit // Properly exit the program
87 case "backspace": 86 case "backspace":
88 if len(m.filter) > 0 { 87 if len(m.filter) > 0 {
89 m.filter = m.filter[:len(m.filter)-1] 88 m.filter = m.filter[:len(m.filter)-1]
@@ -463,6 +462,11 @@ func DynamicSelect(options []SelectionOption) (SelectionOption, error) {
463 return SelectionOption{}, fmt.Errorf("unexpected model type") 462 return SelectionOption{}, fmt.Errorf("unexpected model type")
464 } 463 }
465 464
465 // Check if the program was quit with Ctrl+C
466 if err != nil {
467 return SelectionOption{Key: "-1", Label: "Quit"}, nil
468 }
469
466 if finalSelectionModel.selected < len(finalSelectionModel.filteredKeys) { 470 if finalSelectionModel.selected < len(finalSelectionModel.filteredKeys) {
467 return finalSelectionModel.filteredKeys[finalSelectionModel.selected], nil 471 return finalSelectionModel.filteredKeys[finalSelectionModel.selected], nil
468 } 472 }