[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: failing repro for wide-char-overlay

Nate Moore (Jun 4, 2026, 12:33 AM -0500) 352cb27b d75fb4b6

+54
+54
test/wide-char-overlay.test.ts
··· 1 + import { beforeEach, describe, expect, it } from "./suite.ts"; 2 + import { createTerm, type Term } from "../term.ts"; 3 + import { close, fixed, grow, open, text } from "../ops.ts"; 4 + import { print } from "./print.ts"; 5 + 6 + const decode = (b: Uint8Array) => new TextDecoder().decode(b); 7 + 8 + describe("wide-char trailing overlay", () => { 9 + let term: Term; 10 + beforeEach(async () => { 11 + term = await createTerm({ width: 12, height: 1 }); 12 + }); 13 + 14 + it("overlay on a wide char's trailing column clears the orphaned lead to a space", () => { 15 + // X is floated onto col 1, the trailing column of 你 (cols 0-1). 16 + let out = print( 17 + decode( 18 + term.render([ 19 + open("root", { layout: { width: grow(), height: grow() } }), 20 + text("你好"), 21 + open("ov", { 22 + floating: { x: 1, y: 0, attachTo: 3 }, 23 + layout: { width: fixed(1), height: fixed(1) }, 24 + }), 25 + text("X"), 26 + close(), 27 + close(), 28 + ]).output, 29 + ), 30 + 12, 31 + 1, 32 + ); 33 + // pins: half-overwritten 你 collapses to a space, X lands at col 1, 好 untouched at 2-3. 34 + expect(out).toBe(" X好 "); 35 + }); 36 + 37 + it("emits an explicit byte for an overlay landing on a placeholder column", () => { 38 + let ansi = decode( 39 + term.render([ 40 + open("root", { layout: { width: grow(), height: grow() } }), 41 + text("你好"), 42 + open("ov", { 43 + floating: { x: 1, y: 0, attachTo: 3 }, 44 + layout: { width: fixed(1), height: fixed(1) }, 45 + }), 46 + text("X"), 47 + close(), 48 + close(), 49 + ]).output, 50 + ); 51 + // pins: the overlay glyph reaches the byte stream rather than being swallowed by the column skip. 52 + expect(ansi).toContain("X"); 53 + }); 54 + });