fix(tui): align footer labels with transcript
This commit is contained in:
1 parent
9b72ebe228
commit
594b2e130c
2 files changed
+25
No files matched your search
@@ -2371,6 +2371,27 @@ describe("NanobotTui layout", () => {
|
|||||||
expect(assistantMarker?.renderable.fg.toInts().slice(0, 3)).toEqual([161, 161, 170])
|
expect(assistantMarker?.renderable.fg.toInts().slice(0, 3)).toEqual([161, 161, 170])
|
||||||
})
|
})
|
||||||
|
|
||||||
|
test("aligns footer labels with transcript content", async () => {
|
||||||
|
setup = await createRenderer({ width: 72, height: 24, screenMode: "alternate-screen" })
|
||||||
|
const app = mount(setup)
|
||||||
|
app.accept({ event: "attached", chat_id: "chat" })
|
||||||
|
;(app as unknown as { transcript: { user(content: string): void } })
|
||||||
|
.transcript.user("Aligned message")
|
||||||
|
await waitUntil(() => (app as unknown as { ready: boolean }).ready)
|
||||||
|
await setup.renderOnce()
|
||||||
|
|
||||||
|
const lines = setup.captureCharFrame().split("\n")
|
||||||
|
const column = (needle: string): number => {
|
||||||
|
const line = lines.find((candidate) => candidate.includes(needle))
|
||||||
|
if (!line) throw new Error(`${needle} was not rendered`)
|
||||||
|
return line.indexOf(needle)
|
||||||
|
}
|
||||||
|
const contentColumn = column("Aligned message")
|
||||||
|
|
||||||
|
expect(column("default ▾")).toBe(contentColumn)
|
||||||
|
expect(column("Ready")).toBe(contentColumn)
|
||||||
|
})
|
||||||
|
|
||||||
test("shows context usage in the idle footer", async () => {
|
test("shows context usage in the idle footer", async () => {
|
||||||
setup = await createRenderer({ width: 88, height: 24, screenMode: "alternate-screen" })
|
setup = await createRenderer({ width: 88, height: 24, screenMode: "alternate-screen" })
|
||||||
const app = mount(setup)
|
const app = mount(setup)
|
||||||
|
|||||||
@@ -214,6 +214,8 @@ const TERMINAL: Palette = {
|
|||||||
const COMPOSER_PLACEHOLDER = "Ask nanobot anything"
|
const COMPOSER_PLACEHOLDER = "Ask nanobot anything"
|
||||||
const ACTIVE_COMPOSER_PLACEHOLDER = "Enter send now · Tab send next"
|
const ACTIVE_COMPOSER_PLACEHOLDER = "Enter send now · Tab send next"
|
||||||
const COMPACT_ACTIVE_COMPOSER_PLACEHOLDER = "Enter now · Tab next"
|
const COMPACT_ACTIVE_COMPOSER_PLACEHOLDER = "Enter now · Tab next"
|
||||||
|
// Transcript text starts after one content-padding cell and a two-cell role marker.
|
||||||
|
const TRANSCRIPT_TEXT_INSET = 3
|
||||||
const IMAGE_PLACEHOLDER_STYLE = "image.placeholder"
|
const IMAGE_PLACEHOLDER_STYLE = "image.placeholder"
|
||||||
const SHIMMER_PAUSE = 16
|
const SHIMMER_PAUSE = 16
|
||||||
const SHIMMER_BAND = 4
|
const SHIMMER_BAND = 4
|
||||||
@@ -756,6 +758,7 @@ export class NanobotTui {
|
|||||||
flexShrink: 0,
|
flexShrink: 0,
|
||||||
flexDirection: "row",
|
flexDirection: "row",
|
||||||
alignItems: "center",
|
alignItems: "center",
|
||||||
|
paddingLeft: TRANSCRIPT_TEXT_INSET,
|
||||||
backgroundColor: RGBA.defaultBackground(),
|
backgroundColor: RGBA.defaultBackground(),
|
||||||
})
|
})
|
||||||
this.runtimeControls = new RuntimeControls(
|
this.runtimeControls = new RuntimeControls(
|
||||||
@@ -877,6 +880,7 @@ export class NanobotTui {
|
|||||||
flexDirection: "row",
|
flexDirection: "row",
|
||||||
justifyContent: "space-between",
|
justifyContent: "space-between",
|
||||||
gap: 2,
|
gap: 2,
|
||||||
|
paddingLeft: TRANSCRIPT_TEXT_INSET,
|
||||||
})
|
})
|
||||||
this.composerFrame.add(this.composer)
|
this.composerFrame.add(this.composer)
|
||||||
statusRow.add(this.status)
|
statusRow.add(this.status)
|
||||||
|
|||||||
Reference in new issue
Block a user