Queue UI output and status updates
This commit is contained in:
committed by
Brandon McGinty
parent
b10e08477c
commit
12761f29ca
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user