Skip to content

Commit

Permalink
bugfix: Fixed missing attention messages with duration 0
Browse files Browse the repository at this point in the history
  • Loading branch information
F1bonacc1 committed Aug 9, 2024
1 parent 5c83437 commit e207158
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/tui/stat-table.go
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Expand All @@ -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()
}()
Expand Down

0 comments on commit e207158

Please sign in to comment.