Render initial chat prompt and submitted messages

This commit is contained in:
Brandon McGinty (chatgpt)
2026-08-09 22:17:24 -04:00
committed by Brandon McGinty
parent 21e0627509
commit dc9dedb523
2 changed files with 14 additions and 3 deletions
+7 -2
View File
@@ -78,6 +78,10 @@ func (b *Barnard) UpdateInputStatus(status string) {
} }
b.Ui.Post(func() { b.Ui.Post(func() {
b.UiInputStatus.Text = status 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.RebuildUserChannelTreePreservingSelection()
b.Ui.Refresh() b.Ui.Refresh()
}) })
@@ -516,8 +520,9 @@ func (b *Barnard) OnUiInitialize(ui *uiterm.Ui) {
ui.Add(uiViewInput, &b.UiInput) ui.Add(uiViewInput, &b.UiInput)
b.UiInputStatus = uiterm.Label{ b.UiInputStatus = uiterm.Label{
Fg: uiterm.ColorBlack, Text: "[root]",
Bg: uiterm.ColorWhite, Fg: uiterm.ColorBlack,
Bg: uiterm.ColorWhite,
} }
ui.Add(uiViewInputStatus, &b.UiInputStatus) ui.Add(uiViewInputStatus, &b.UiInputStatus)
+7 -1
View File
@@ -147,7 +147,13 @@ func (t *Textbox) uiKeyEvent(key Key) {
// } // }
} }
if redraw { 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()
}
} }
} }