diff --git a/ui.go b/ui.go index 972387d..19ffb59 100644 --- a/ui.go +++ b/ui.go @@ -78,6 +78,10 @@ func (b *Barnard) UpdateInputStatus(status string) { } b.Ui.Post(func() { b.UiInputStatus.Text = status + // The initial connection status arrives after Run's first layout. Relayout + // so the prompt has cells to draw before focus is changed. + width, height := termbox.Size() + b.OnUiResize(b.Ui, width, height) b.RebuildUserChannelTreePreservingSelection() b.Ui.Refresh() }) @@ -516,8 +520,9 @@ func (b *Barnard) OnUiInitialize(ui *uiterm.Ui) { ui.Add(uiViewInput, &b.UiInput) b.UiInputStatus = uiterm.Label{ - Fg: uiterm.ColorBlack, - Bg: uiterm.ColorWhite, + Text: "[root]", + Fg: uiterm.ColorBlack, + Bg: uiterm.ColorWhite, } ui.Add(uiViewInputStatus, &b.UiInputStatus) diff --git a/uiterm/textbox.go b/uiterm/textbox.go index b35bd08..304ca99 100644 --- a/uiterm/textbox.go +++ b/uiterm/textbox.go @@ -147,7 +147,13 @@ func (t *Textbox) uiKeyEvent(key Key) { // } } if redraw { - t.uiDraw() + // Input callbacks may update another view (for example, append a chat + // message). Redraw every view after submission, not just this textbox. + if key == KeyEnter && t.ui != nil { + t.ui.Refresh() + } else { + t.uiDraw() + } } }