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:
+10
-1
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user