From e2071582638ee41e7320071abfdb0d03420fa62e Mon Sep 17 00:00:00 2001 From: Berger Eugene Date: Sat, 27 Jul 2024 02:26:14 +0300 Subject: [PATCH] bugfix: Fixed missing attention messages with duration 0 --- src/tui/stat-table.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/tui/stat-table.go b/src/tui/stat-table.go index 000459c..510779b 100644 --- a/src/tui/stat-table.go +++ b/src/tui/stat-table.go @@ -71,10 +71,10 @@ func (pv *pcView) getHostNameTitle() string { } } +// AttentionMessage shows an attention message in the status table +// It will disappear after the specified duration +// duration == 0 will not hide the message func (pv *pcView) attentionMessage(message string, duration time.Duration) { - if duration == 0 { - return - } go func() { pv.appView.QueueUpdateDraw(func() { pv.statTable.SetCell(0, 2, tview.NewTableCell(message). @@ -84,6 +84,9 @@ func (pv *pcView) attentionMessage(message string, duration time.Duration) { SetTextColor(tview.Styles.ContrastSecondaryTextColor). SetBackgroundColor(tview.Styles.MoreContrastBackgroundColor)) }) + if duration == 0 { + return + } time.Sleep(duration) pv.hideAttentionMessage() }()