Render initial chat prompt and submitted messages
This commit is contained in:
committed by
Brandon McGinty
parent
21e0627509
commit
dc9dedb523
@@ -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
@@ -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()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user