opentui(v2): fix streaming caret alignment during model response (item 10)

A just-started assistant turn (message.start, no deltas yet) rendered an EMPTY
fallback <text> on the glyph's line plus the `▍` caret on a SEPARATE line below —
so `⚕` sat alone with the caret dangling beneath it, indented. Folded the caret
into the no-parts fallback so it renders inline with the glyph (` ⚕ ▍`); a settled
row still shows its flat text, a turn with parts renders the parts. 71 pass.

Live-smoked: streaming start now shows `⚕ ▍` on one line; the reply text then
aligns with the glyph.
This commit is contained in:
alt-glitch 2026-06-08 18:13:04 +00:00
parent 37b74f4df3
commit f423aebb80

View file

@ -36,9 +36,21 @@ export function MessageLine(props: { message: Message }) {
<Show
when={m().role === 'assistant' && hasParts()}
fallback={
<text>
<span style={{ fg: theme().color.text }}>{m().text}</span>
</text>
// No parts yet: the just-started streaming turn shows ONLY the caret,
// inline with the glyph (not an empty line + a dangling caret below —
// item 10 cursor misalignment); a settled row shows its flat text.
<Show
when={m().streaming && !hasParts()}
fallback={
<text>
<span style={{ fg: theme().color.text }}>{m().text}</span>
</text>
}
>
<text>
<span style={{ fg: theme().color.muted }}></span>
</text>
</Show>
}
>
<For each={m().parts ?? []}>
@ -59,11 +71,6 @@ export function MessageLine(props: { message: Message }) {
)}
</For>
</Show>
<Show when={m().streaming && !hasParts()}>
<text>
<span style={{ fg: theme().color.muted }}></span>
</text>
</Show>
</box>
</box>
)