Fix 'Clear Completed' to return to previous module when queue is empty

When 'Clear Completed' empties the queue, return to the previous
module instead of staying in an empty queue view. If jobs remain
after clearing, stay in queue view and refresh.
This commit is contained in:
Stu Leak 2025-12-17 01:04:22 -05:00
parent ac59fad380
commit a9ba43a03b

12
main.go
View File

@ -1121,7 +1121,17 @@ func (s *appState) refreshQueueView() {
func() { // onClear
s.jobQueue.Clear()
s.clearVideo()
s.refreshQueueView() // Refresh
// If queue is now empty, return to previous module
if len(s.jobQueue.List()) == 0 {
if s.lastModule != "" && s.lastModule != "queue" {
s.showModule(s.lastModule)
} else {
s.showMainMenu()
}
} else {
s.refreshQueueView() // Refresh if jobs remain
}
},
func() { // onClearAll
s.jobQueue.ClearAll()