style(tui): simplify picker overflow indicator

This commit is contained in:
chengyongru authored and chengyongru committed 2026-09-29 14:34:01 +08:00
1 parent 740e39b1ca
commit 509304f9bb
3 files changed
+7 -7

No files matched your search

+2 -2
View File
@@ -1503,13 +1503,13 @@ describe("NanobotTui layout", () => {
await waitUntil(() => ui.runtimeControls.visible)
await setup.flush()
expect(ui.runtimeControls.menuRoot.getChildren()).toHaveLength(9)
expect(setup.captureCharFrame()).toContain("1–8 of 11 · ↓")
expect(setup.captureCharFrame()).toContain("1–8 of 11 ↓")
expect(setup.captureCharFrame()).not.toContain("preset-8")
for (let index = 0; index < 9; index += 1) setup.mockInput.pressArrow("down")
await setup.flush()
expect(setup.captureCharFrame()).toContain("› preset-8")
expect(setup.captureCharFrame()).toContain("3–10 of 11 · ↑↓")
expect(setup.captureCharFrame()).toContain("3–10 of 11 ↑↓")
setup.mockInput.pressEnter()
await waitUntil(() => sent.includes("/model preset-8"))
+4 -4
View File
@@ -42,7 +42,7 @@ describe("PickerMenu", () => {
await setup.renderOnce()
expect(menu.root.getChildren().filter((child) => child.id !== "test-picker-overflow")).toHaveLength(3)
expect(setup.captureCharFrame()).toContain("1–3 of 5 · ↓")
expect(setup.captureCharFrame()).toContain("1–3 of 5 ↓")
expect(setup.captureCharFrame()).not.toContain("Choice 3")
menu.move(1)
@@ -50,7 +50,7 @@ describe("PickerMenu", () => {
menu.move(1)
await setup.flush()
expect(menu.current()?.id).toBe("3")
expect(setup.captureCharFrame()).toContain("2–4 of 5 · ↑↓")
expect(setup.captureCharFrame()).toContain("2–4 of 5 ↑↓")
expect(setup.captureCharFrame()).toContain("› Choice 3")
expect(setup.captureCharFrame()).not.toContain("Choice 0")
@@ -60,7 +60,7 @@ describe("PickerMenu", () => {
menu.move(-1)
await setup.flush()
expect(menu.current()?.id).toBe("4")
expect(setup.captureCharFrame()).toContain("3–5 of 5 · ↑")
expect(setup.captureCharFrame()).toContain("3–5 of 5 ↑")
const firstVisible = menu.root.getChildren()[0] as TextRenderable | undefined
if (!firstVisible) throw new Error("picker row was not rendered")
@@ -88,7 +88,7 @@ describe("PickerMenu", () => {
await setup.renderOnce()
expect(menu.current()?.id).toBe("d")
expect(setup.captureCharFrame()).toContain("› Choice d")
expect(setup.captureCharFrame()).toContain("2–3 of 3 · ↑")
expect(setup.captureCharFrame()).toContain("2–3 of 3 ↑")
menu.update("e", 2)
await setup.flush()
+1 -1
View File
@@ -199,7 +199,7 @@ export class PickerMenu<T> {
const directions = `${this.windowStart > 0 ? "↑" : ""}${end < this.matches.length ? "↓" : ""}`
this.root.add(new TextRenderable(this.renderer, {
id: `${this.options.id}-overflow`,
content: ` ${this.windowStart + 1}–${end} of ${this.matches.length} · ${directions}`,
content: ` ${this.windowStart + 1}–${end} of ${this.matches.length} ${directions}`,
width: "100%",
height: 1,
wrapMode: "none",