fix(tui): align composer with transcript
This commit is contained in:
1 parent
594b2e130c
commit
9fb82f6ece
2 files changed
+13
-8
No files matched your search
+9
-5
@@ -2381,15 +2381,19 @@ describe("NanobotTui layout", () => {
|
|||||||
await setup.renderOnce()
|
await setup.renderOnce()
|
||||||
|
|
||||||
const lines = setup.captureCharFrame().split("\n")
|
const lines = setup.captureCharFrame().split("\n")
|
||||||
const column = (needle: string): number => {
|
const lineContaining = (needle: string): string => {
|
||||||
const line = lines.find((candidate) => candidate.includes(needle))
|
const line = lines.find((candidate) => candidate.includes(needle))
|
||||||
if (!line) throw new Error(`${needle} was not rendered`)
|
if (!line) throw new Error(`${needle} was not rendered`)
|
||||||
return line.indexOf(needle)
|
return line
|
||||||
}
|
}
|
||||||
const contentColumn = column("Aligned message")
|
const messageLine = lineContaining("Aligned message")
|
||||||
|
const composerLine = lineContaining("Ask nanobot anything")
|
||||||
|
const contentColumn = messageLine.indexOf("Aligned message")
|
||||||
|
|
||||||
expect(column("default ▾")).toBe(contentColumn)
|
expect(lineContaining("default ▾").indexOf("default ▾")).toBe(contentColumn)
|
||||||
expect(column("Ready")).toBe(contentColumn)
|
expect(lineContaining("Ready").indexOf("Ready")).toBe(contentColumn)
|
||||||
|
expect(composerLine.indexOf("│")).toBe(messageLine.indexOf("›"))
|
||||||
|
expect(composerLine.indexOf("Ask nanobot anything")).toBe(contentColumn)
|
||||||
})
|
})
|
||||||
|
|
||||||
test("shows context usage in the idle footer", async () => {
|
test("shows context usage in the idle footer", async () => {
|
||||||
|
|||||||
+4
-3
@@ -214,8 +214,9 @@ 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.
|
// Transcript rows start one cell inside the shell; text follows their two-cell role marker.
|
||||||
const TRANSCRIPT_TEXT_INSET = 3
|
const TRANSCRIPT_EDGE_INSET = 1
|
||||||
|
const TRANSCRIPT_TEXT_INSET = TRANSCRIPT_EDGE_INSET + 2
|
||||||
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
|
||||||
@@ -799,9 +800,9 @@ export class NanobotTui {
|
|||||||
const composerSurface = this.composerSurface()
|
const composerSurface = this.composerSurface()
|
||||||
this.composerFrame = new BoxRenderable(renderer, {
|
this.composerFrame = new BoxRenderable(renderer, {
|
||||||
id: "nanobot-tui-composer-frame",
|
id: "nanobot-tui-composer-frame",
|
||||||
width: "100%",
|
|
||||||
minHeight: 1,
|
minHeight: 1,
|
||||||
flexShrink: 0,
|
flexShrink: 0,
|
||||||
|
marginLeft: TRANSCRIPT_EDGE_INSET,
|
||||||
border: ["left"],
|
border: ["left"],
|
||||||
borderColor: this.palette.accent,
|
borderColor: this.palette.accent,
|
||||||
paddingLeft: 1,
|
paddingLeft: 1,
|
||||||
|
|||||||
Reference in new issue
Block a user