diff --git a/tui/consts.go b/tui/consts.go index c7f8c52..e2a45cd 100644 --- a/tui/consts.go +++ b/tui/consts.go @@ -12,6 +12,11 @@ const ( cursorPosGeneralRight cursorPosConfigValue = -3 ) +const ( + CONST_MESSAGE_LEN = 1024 + CONST_ERROR_N_TITLE = "ERROR" +) + const ( footerStart = "State: " ) diff --git a/tui/notification.go b/tui/notification.go index b109740..c7860c2 100644 --- a/tui/notification.go +++ b/tui/notification.go @@ -18,8 +18,7 @@ func centerText(width int, text string) string { ) } -func createNotification(message string) (notifier, error) { - title := "ERROR" +func createNotification(message, title string) (notifier, error) { var buf string width, height := UI.getSizes() if width == 0 { diff --git a/tui/ui.go b/tui/ui.go index ceec6d5..de5d438 100644 --- a/tui/ui.go +++ b/tui/ui.go @@ -144,8 +144,8 @@ func (t *TUI) Run() error { return nil } -func (t *TUI) createNotification(text string) { - notifier, err := createNotification(text) +func (t *TUI) createNotification(text, title string) { + notifier, err := createNotification(text, title) t.selectedNotifier = ¬ifier t.errors <- err t.errors <- t.write(notifier.Buf) @@ -159,7 +159,7 @@ func (t *TUI) setRoutines() error { go func() { for err := range t.errors { if err != nil { - t.createNotification(err.Error()) + t.createNotification(err.Error(), CONST_ERROR_N_TITLE) } } }() @@ -183,6 +183,7 @@ func (t *TUI) setRoutines() error { } go func() { for message := range t.messageChannel { + t.createNotification(string(message), "Message!") } }() go func() {