Release list: close after a successful grab

Back to where the search started (library, drill-down or search), unless
something was opened on top of the list meanwhile.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-23 23:54:15 +02:00
co-authored by Claude Opus 5.5
parent 5b8100eb54
commit 7261667d72
3 changed files with 12 additions and 1 deletions
+1
View File
@@ -2,6 +2,7 @@
## Unreleased
- **After a grab** the release list closes and you are back where the search started.
- **Season posters** in the series drill-down: a season and its episodes show the season's poster
(from TheTVDB, via Sonarr), the series poster where a season has none or it cannot be loaded.
- **Cast in the details pane:** with a Trakt client ID, the details of a movie or series list its
+10 -1
View File
@@ -101,6 +101,7 @@ var serviceNames = []string{"Radarr", "Sonarr", "SABnzbd"}
// hints replaces the view's key hints in the status bar while it is open.
type overlay struct {
page string
root tview.Primitive // what was pushed
focus tview.Primitive
hints string
full bool // full-screen view (can be left with F1-F7), as opposed to a dialog
@@ -527,7 +528,7 @@ func (a *App) renderStatus() {
// pushOverlay stacks p above everything and focuses focus.
func (a *App) pushOverlay(p, focus tview.Primitive, hints string, full bool, onClose func()) {
name := fmt.Sprintf("overlay-%d", len(a.overlays))
a.overlays = append(a.overlays, overlay{page: name, focus: a.app.GetFocus(), hints: hints, full: full, close: onClose})
a.overlays = append(a.overlays, overlay{page: name, root: p, focus: a.app.GetFocus(), hints: hints, full: full, close: onClose})
a.pages.AddPage(name, p, true, true)
a.app.SetFocus(focus)
a.renderStatus()
@@ -566,6 +567,14 @@ func (a *App) openFull(p tview.Primitive, hints string, onClose func()) {
a.pushOverlay(p, p, hints, true, onClose)
}
// closeIfTop closes the topmost overlay if it is p (and not something opened
// on top of it since).
func (a *App) closeIfTop(p tview.Primitive) {
if n := len(a.overlays); n > 0 && a.overlays[n-1].root == p {
a.closeModal()
}
}
// closeModal removes the topmost overlay and restores the previous focus.
func (a *App) closeModal() {
if len(a.overlays) == 0 {
+1
View File
@@ -269,6 +269,7 @@ func (v *releasesView) doGrab(r arr.Release) {
return
}
v.app.SetMessage("[green]Sent to the download client: " + tview.Escape(truncate(r.Title, 60)))
v.app.closeIfTop(v.root) // done here: back to where the search started
})
}()
}