Queue UI output and status updates

This commit is contained in:
Brandon McGinty (chatgpt)
2026-08-09 19:37:18 -04:00
committed by Brandon McGinty
parent b10e08477c
commit 12761f29ca
3 changed files with 51 additions and 4 deletions
+13 -4
View File
@@ -63,9 +63,14 @@ func (b *Barnard) GetInputStatus() string {
func (b *Barnard) UpdateInputStatus(status string) {
status = truncateInputStatus(status)
b.UiInputStatus.Text = status
b.RebuildUserChannelTreePreservingSelection()
b.Ui.Refresh()
if b.Ui == nil {
return
}
b.Ui.Post(func() {
b.UiInputStatus.Text = status
b.RebuildUserChannelTreePreservingSelection()
b.Ui.Refresh()
})
}
// truncateInputStatus limits terminal cells without splitting UTF-8 runes.
@@ -79,7 +84,11 @@ func truncateInputStatus(status string) string {
func (b *Barnard) AddOutputLine(line string) {
now := time.Now()
b.UiOutput.AddLine(fmt.Sprintf("%s [%02d:%02d:%02d]", line, now.Hour(), now.Minute(), now.Second()))
formatted := fmt.Sprintf("%s [%02d:%02d:%02d]", line, now.Hour(), now.Minute(), now.Second())
if b.Ui == nil {
return
}
b.Ui.Post(func() { b.UiOutput.AddLine(formatted) })
}
func (b *Barnard) AddOutputMessage(sender *gumble.User, message string) {