Keep the diff and pull request status lines from shrinking away

OpenTUI 0.8 draws nothing for a node Yoga shrinks to zero rows, so a status
line above a long scrollbox vanished instead of overlapping its first row.
This commit is contained in:
Callum Alpass committed 2026-11-03 02:09:44 +11:00
1 parent 1399112379
commit 32ac1a2a32
2 files changed
+6 -6

No files matched your search

+4 -4
View File
@@ -33,10 +33,10 @@ export function DiffView(props: { readonly diff: DiffState; readonly scrollRef:
<box flexGrow={1} />
<text fg={colors.faint}>{diff.source ? "[/] file · x whole file / collapse · esc close" : "[/] file · esc close"}</text>
</box>
{diff.status === "loading" ? <text fg={colors.muted}>Loading diff…</text> : null}
{diff.status === "error" ? <text fg={colors.bad}>{`Could not load the diff: ${diff.error ?? "unknown error"}`}</text> : null}
{diff.status === "ready" && files.length === 0 ? <text fg={colors.muted}>No changes.</text> : null}
{diff.truncated ? <text fg={colors.warn}>The diff was too large and is cut short.</text> : null}
{diff.status === "loading" ? <text fg={colors.muted} flexShrink={0}>Loading diff…</text> : null}
{diff.status === "error" ? <text fg={colors.bad} flexShrink={0}>{`Could not load the diff: ${diff.error ?? "unknown error"}`}</text> : null}
{diff.status === "ready" && files.length === 0 ? <text fg={colors.muted} flexShrink={0}>No changes.</text> : null}
{diff.truncated ? <text fg={colors.warn} flexShrink={0}>The diff was too large and is cut short.</text> : null}
<scrollbox ref={props.scrollRef} flexGrow={1} minHeight={0}>
{files.map((file, index) => (
<box key={file.path} id={`diff-file-${index}`} flexDirection="column" marginTop={1}>
+2 -2
View File
@@ -39,8 +39,8 @@ export function PullRequestView(props: { readonly view: PullRequestViewState; re
<text> </text>
<Button label="Close" shortcut="esc" onPress={props.onClose} />
</box>
{view.status === "loading" ? <text fg={colors.muted}>Loading pull request…</text> : null}
{view.status === "error" ? <text fg={colors.bad}>{`Could not load the pull request: ${view.error ?? "unknown error"}`}</text> : null}
{view.status === "loading" ? <text fg={colors.muted} flexShrink={0}>Loading pull request…</text> : null}
{view.status === "error" ? <text fg={colors.bad} flexShrink={0}>{`Could not load the pull request: ${view.error ?? "unknown error"}`}</text> : null}
<scrollbox ref={props.scrollRef} flexGrow={1} minHeight={0}>
{view.lines.map((line, index) =>
line.kind === "title" && index > 0 ? (