diff options
| author | Grail Finder <wohilas@gmail.com> | 2026-03-05 08:51:04 +0300 |
|---|---|---|
| committer | Grail Finder <wohilas@gmail.com> | 2026-03-05 08:51:04 +0300 |
| commit | 57088565bd7a3edbf55d63780573096124a1fc1b (patch) | |
| tree | 9a28dd9092881a236b811dd7974c9948e83ef083 | |
| parent | 4b6769e531ab844db2ed98445c13df9e2c781776 (diff) | |
Fix (notification): being closed by prev notification early
| -rw-r--r-- | tui.go | 11 |
1 files changed, 5 insertions, 6 deletions
@@ -38,6 +38,7 @@ var ( roleEditWindow *tview.InputField shellInput *tview.InputField confirmModal *tview.Modal + toastTimer *time.Timer confirmPageName = "confirm" fullscreenMode bool positionVisible bool = true @@ -156,10 +157,11 @@ func showToast(title, message string) { } title = sanitize(title, 50) message = sanitize(message, 197) - + if toastTimer != nil { + toastTimer.Stop() + } notificationWidget.SetTitle(title) notificationWidget.SetText(fmt.Sprintf("[yellow]%s[-]", message)) - go func() { app.QueueUpdateDraw(func() { flex.RemoveItem(bottomFlex) @@ -173,8 +175,7 @@ func showToast(title, message string) { } }) }() - - time.AfterFunc(3*time.Second, func() { + toastTimer = time.AfterFunc(3*time.Second, func() { app.QueueUpdateDraw(func() { flex.RemoveItem(bottomFlex) flex.RemoveItem(statusLineWidget) @@ -299,11 +300,9 @@ func init() { SetChangedFunc(func() { }) notificationWidget.SetBorder(true).SetTitle("notification") - bottomFlex = tview.NewFlex().SetDirection(tview.FlexColumn). AddItem(textArea, 0, 1, true). AddItem(notificationWidget, 0, 0, false) - // flex = tview.NewFlex().SetDirection(tview.FlexRow). AddItem(textView, 0, 40, false). |
