Skip to content

Commit 0c56df0

Browse files
authored
Merge pull request os-autoinst#162 from grisu48/header
Fix header when resizing
2 parents 510fd53 + 857bb5b commit 0c56df0

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

cmd/openqa-mon/tui.go

+6-1
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,7 @@ func (tui *TUI) Start() {
210210
signal.Notify(sigs, syscall.SIGWINCH)
211211
for {
212212
<-sigs
213+
tui.UpdateHeader()
213214
tui.Update()
214215
}
215216
}()
@@ -270,7 +271,11 @@ func (tui *TUI) SetHideStates(enabled bool) {
270271
}
271272

272273
func (tui *TUI) UpdateHeader() {
273-
tui.header = fmt.Sprintf("openqa-mon v%s - Monitoring %s - Page %d/%d", internal.VERSION, tui.remotes, 1+tui.currentPage, tui.totalPages)
274+
if tui.totalPages > 1 {
275+
tui.header = fmt.Sprintf("openqa-mon v%s - Monitoring %s - Page %d/%d", internal.VERSION, tui.remotes, tui.currentPage+1, tui.totalPages)
276+
} else {
277+
tui.header = fmt.Sprintf("openqa-mon v%s - Monitoring %s", internal.VERSION, tui.remotes)
278+
}
274279
}
275280

276281
func (tui *TUI) FirstPage() {

0 commit comments

Comments
 (0)