[READ-ONLY] Mirror of https://github.com/bombshell-dev/tty. Platform independent 2D layout engine for terminal applications based on Clay
5

Configure Feed

Select the types of activity you want to include in your feed.

🧪 test(term): document v1 limitation for caret on empty text

Charles Lowell (Jul 2, 2026, 6:29 PM +0300) a7d47a05 0d3afa9d

+20
+20
test/term.test.ts
··· 432 432 expect(ansi).not.toContain("\x1b[?25l"); 433 433 }); 434 434 435 + it("shows the cursor at the text origin when content is empty and caret is 0", () => { 436 + // v1 known limitation: Clay does not emit a text render command for an 437 + // empty string, so locate_caret never finds a matching slice and suppresses 438 + // cursor visibility. The proper fix requires looking up the element's 439 + // bounding box separately (e.g. via get_element_bounds) rather than 440 + // scanning text render commands. Until that is implemented, no cursor 441 + // appears when the caret-bearing text node is empty. 442 + let ansi = decode( 443 + term.render([ 444 + open("root", { 445 + layout: { width: grow(), height: grow(), direction: "ttb" }, 446 + }), 447 + text("", { caret: 0 }), 448 + close(), 449 + ]).output, 450 + ); 451 + expect(ansi).not.toContain("\x1b[?25h"); 452 + expect(ansi).not.toContain("\x1b[?25l"); 453 + }); 454 + 435 455 it("hides the cursor when transitioning from caret-present to caret-absent", () => { 436 456 // First frame: caret declared. 437 457 term.render([