From 857bb5b71eb16e6a2641f2d365d27bd2b73597c7 Mon Sep 17 00:00:00 2001 From: phoenix Date: Wed, 21 Aug 2024 08:37:59 +0200 Subject: [PATCH] Fix header when resizing Update the page count while resizing. --- cmd/openqa-mon/tui.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/cmd/openqa-mon/tui.go b/cmd/openqa-mon/tui.go index a944796..1baf796 100644 --- a/cmd/openqa-mon/tui.go +++ b/cmd/openqa-mon/tui.go @@ -210,6 +210,7 @@ func (tui *TUI) Start() { signal.Notify(sigs, syscall.SIGWINCH) for { <-sigs + tui.UpdateHeader() tui.Update() } }() @@ -270,7 +271,11 @@ func (tui *TUI) SetHideStates(enabled bool) { } func (tui *TUI) UpdateHeader() { - tui.header = fmt.Sprintf("openqa-mon v%s - Monitoring %s - Page %d/%d", internal.VERSION, tui.remotes, 1+tui.currentPage, tui.totalPages) + if tui.totalPages > 1 { + tui.header = fmt.Sprintf("openqa-mon v%s - Monitoring %s - Page %d/%d", internal.VERSION, tui.remotes, tui.currentPage+1, tui.totalPages) + } else { + tui.header = fmt.Sprintf("openqa-mon v%s - Monitoring %s", internal.VERSION, tui.remotes) + } } func (tui *TUI) FirstPage() {