[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 vs16-emoji-width

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

+55
+55
test/vs16-emoji-width.test.ts
··· 1 + import { beforeEach, describe, expect, it } from "./suite.ts"; 2 + import { createTerm, type Term } from "../term.ts"; 3 + import { close, fit, fixed, open, rgba, text } from "../ops.ts"; 4 + import { print } from "./print.ts"; 5 + 6 + const decode = (b: Uint8Array) => new TextDecoder().decode(b); 7 + 8 + const VS16 = "\u{1F321}\u{FE0F}\u{26A0}\u{FE0F}\u{2705}"; // ๐ŸŒก๏ธโš ๏ธโœ… 9 + 10 + describe("vs16 emoji width measurement", () => { 11 + let term: Term; 12 + beforeEach(async () => { 13 + term = await createTerm({ width: 24, height: 3 }); 14 + }); 15 + 16 + it("measures base emoji + U+FE0F as width-2 clusters", () => { 17 + let r = term.render([ 18 + open("box", { layout: { width: fit(), height: fit() } }), 19 + text(VS16), 20 + close(), 21 + ]); 22 + // three emoji-presentation clusters at width 2 each => 6, not 4 23 + expect(r.info.get("box")!.bounds.width).toBe(6); 24 + }); 25 + 26 + it("upgrades a single base+FE0F cluster (โš ๏ธ) to width 2", () => { 27 + let r = term.render([ 28 + open("box", { layout: { width: fit(), height: fit() } }), 29 + text("\u{26A0}\u{FE0F}"), // โš ๏ธ 30 + close(), 31 + ]); 32 + // โš  alone is text-presentation width 1; +U+FE0F selects emoji width 2 33 + expect(r.info.get("box")!.bounds.width).toBe(2); 34 + }); 35 + 36 + it("fitted bordered box around ๐ŸŒก๏ธโš ๏ธโœ… is 8 cells wide", () => { 37 + let r = term.render([ 38 + open("box", { 39 + layout: { width: fit(), height: fixed(3) }, 40 + border: { 41 + color: rgba(255, 255, 255), 42 + left: 1, 43 + right: 1, 44 + top: 1, 45 + bottom: 1, 46 + }, 47 + }), 48 + text(VS16), 49 + close(), 50 + ]); 51 + let grid = print(decode(r.output), 24, 3); 52 + // 6 content cols + 2 border cols => top border โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ” (8 wide) 53 + expect(grid.split("\n")[0]).toBe("โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”" + " ".repeat(16)); 54 + }); 55 + });