mirror of
https://github.com/patriceckhart/zot.git
synced 2026-06-26 21:36:31 +02:00
tui: show /help at the bottom of the transcript instead of the top
the help block was prepended to the chat, which pushed any existing conversation off the top of the viewport on anything but the shortest sessions. appending it (with scrollOffset=0 so the viewport sticks to the bottom) means /help is always visible right above the editor, exactly where the user's eye is already looking. login / model / sessions dialogs already render in the bottom-sticky band between chat and editor, so they weren't affected.
This commit is contained in:
parent
8a13141ace
commit
c0f685f498
1 changed files with 9 additions and 2 deletions
|
|
@ -349,9 +349,12 @@ func (i *Interactive) redraw() {
|
|||
chat = append(welcomeBanner(i.cfg.Theme), chat...)
|
||||
}
|
||||
|
||||
// /help block: rendered above the welcome / transcript when active.
|
||||
// /help block: appended to the transcript so it appears at the
|
||||
// bottom of the chat area (right above the status bar / editor).
|
||||
// Prepending it would push long conversations off the top of the
|
||||
// viewport, which users would miss entirely.
|
||||
if len(i.helpBlock) > 0 {
|
||||
chat = append(append([]string(nil), i.helpBlock...), chat...)
|
||||
chat = append(chat, i.helpBlock...)
|
||||
}
|
||||
|
||||
if i.statusOK != "" {
|
||||
|
|
@ -716,6 +719,10 @@ func (i *Interactive) runSlash(ctx context.Context, cmd string) (done bool) {
|
|||
i.helpBlock = renderHelpBlock(i.cfg.Theme, i.lastCols())
|
||||
i.statusErr = ""
|
||||
i.statusOK = ""
|
||||
// Pin the viewport to the newest content so the help block,
|
||||
// which we just appended to the end of the transcript, is
|
||||
// what the user actually sees.
|
||||
i.scrollOffset = 0
|
||||
i.mu.Unlock()
|
||||
case "/login":
|
||||
i.dialog.Open()
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue