fix(paint): continuous backgroundColor across wrapped text lines

- Wrap each text line with applyChalk(bgProps) after wrapText so
  background color is reapplied on every wrapped line (wrap-ansi
  doesn't carry ANSI state across line breaks)
- Add wrapped-text backgroundColor regression test
- Fix typo: color=" cyan" → color="cyan" in example
- Add FORCE_COLOR=3 debugging tip to AGENTS.md

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Yunfei He
2026-05-25 11:31:00 +08:00
parent e62c802829
commit ca25ccd96e
4 changed files with 21 additions and 5 deletions
@@ -45,3 +45,19 @@ test("child Text inherits backgroundColor from parent Box", async () => {
expect(raw).toContain("hello");
expect(raw).toContain(BG_BLUE);
});
test("wrapped text preserves backgroundColor on every line", async () => {
const { frames } = await render(
() => (
<Box backgroundColor="blue" borderStyle="single" width={10} height={4}>
<Text>long text here</Text>
</Box>
),
{ columns: 20 },
);
const raw = frames.at(-1)!;
const lines = raw.split("\n").filter(Boolean);
for (const line of lines) {
expect(line).toContain(BG_BLUE);
}
});