xonecas.io
70160
Ce

cel-tui / commit 35f09dd

fix: duplicate JSDoc, spec example inconsistency, update TODO

- Removed duplicate doc comment on paintLineGraphemes in paint.ts
- Fixed spec reference chat example: msg.blocks.map → Text(msg.content)
- Updated TODO.md to mark all fixed items with ✅

xonecas2026-04-04 35f09dd04cf774be740fec56c0d157eac75bdfb9 parent 29ac7ad

3 files changed

TODO.md+13−11
@@ -5,6 +5,7 @@ Remaining work, known bugs, and planned improvements.
55 ## Legend
66
77 - 🔧 Bug / spec violation
8+- ✅ Fixed
89 - ❌ Not yet implemented
910 - 💡 Future enhancement
1011
@@ -12,23 +13,25 @@ Remaining work, known bugs, and planned improvements.
1213
1314 ## Bugs / Spec Violations
1415
15-- 🔧 **Uncontrolled container scroll is broken** — `VStack({ overflow: "scroll" }, [...])` without `onScroll` silently drops scroll events. In `cel.ts`, the check `"onScroll" in props` fails when the user omits the callback. The spec says uncontrolled scroll should "just work". Fix: check `props.overflow === "scroll"` instead. No existing tests cover this case.
16+- ✅ ~~**Uncontrolled container scroll is broken**~~ — Fixed: changed `"onScroll" in props` to `overflow === "scroll"`, added path-based persistence for uncontrolled scroll state across re-renders.
1617
17-- 🔧 **Wide character (CJK/emoji) rendering broken in emitter** — `paintLineGraphemes` writes wide chars to the cell buffer but never writes a continuation marker to the second cell. The emitter iterates every cell sequentially, so the empty cell at position x+1 overwrites the right half of the wide char. The `CellBuffer` doc says wide chars use continuation markers, but paint never writes them and the emitter never skips them. Paint tests pass because they only check buffer contents, not em …
18+- ✅ ~~**Wide character (CJK/emoji) rendering broken in emitter**~~ — Fixed: paint writes continuation markers (char="") for wide chars, emitter skips them.
1819
19-- 🔧 **Hit testing ignores scroll offsets** — `hitTest()` uses original layout rects, not scroll-adjusted positions. Clicking on items in a scrolled container hits the wrong node (pre-scroll position). `shiftLayoutNode` only adjusts rects during painting, not in `currentLayouts` used by hit detection.
20+- ✅ ~~**Hit testing ignores scroll offsets**~~ — Fixed: hitTest() accepts a scroll offset resolver and adjusts coordinates when descending into scrollable containers.
2021
21-- 🔧 **TextInput padding accepted but never applied** — `TextInputProps extends ContainerProps` accepts `padding`, but `layout.ts` treats TextInput as a leaf node (no padding subtraction). `paintTextInput` also ignores padding. The spec says TextInput accepts "Container sizing props (width, height, flex, min\*, max\*, padding)".
22+- ✅ ~~**TextInput padding accepted but never applied**~~ — Fixed: layout intrinsic size accounts for padding, paint insets content area by padding.
2223
23-- 🔧 **TextInput placeholder doesn't inherit styles** — `paintTextInput` passes `props.placeholder.props` directly to `paintText`, bypassing the TextInput's resolved inherited styles. A placeholder without explicit `fgColor` won't inherit from parent containers, unlike all other nodes.
24+- ✅ ~~**TextInput placeholder doesn't inherit styles**~~ — Fixed: placeholder text inherits the TextInput's resolved style chain.
2425
25-- 🔧 **Key bubbling spuriously consumes keys** — When all `onKeyPress` handlers in the bubbling chain return `false`, the key is still treated as consumed (triggers render, returns early) due to `if (consumed || handlers.length > 0)`. Per spec, `false` means not consumed. Causes unnecessary re-renders.
26+- ✅ ~~**Key bubbling spuriously consumes keys**~~ — Fixed: focused path always returns after bubbling (no double-dispatch to root), only renders when consumed.
2627
27-- 🔧 **`getMaxScrollOffset` doesn't account for padding** — The max scroll offset calculation uses raw child rects relative to the container rect but doesn't subtract padding. Scrollable containers with padding allow scrolling past content.
28+- ✅ ~~**`getMaxScrollOffset` doesn't account for padding**~~ — Fixed: adds padding to content extent in max offset calculation.
2829
29-- 🔧 **TextInput cursor movement doesn't handle multi-codepoint graphemes** — `deleteBackward`/`deleteForward` in `text-edit.ts` operate on single string indices. For multi-codepoint characters (emoji ZWJ sequences, combining marks), this leaves the cursor mid-grapheme. `moveCursor` has the same issue.
30+- ✅ ~~**Spec reference example inconsistency**~~ — Fixed: changed `msg.blocks.map(...)` to `Text(msg.content)`.
31+
32+- ✅ ~~**Duplicate JSDoc in paint.ts**~~ — Fixed: removed duplicate doc comment on `paintLineGraphemes`.
3033
31-- 🔧 **Spec reference example inconsistency** — The chat example uses `msg.blocks.map(...)` but message construction only sets `content`, not `blocks`.
34+- 🔧 **TextInput cursor movement doesn't handle multi-codepoint graphemes** — `deleteBackward`/`deleteForward` in `text-edit.ts` operate on single string indices. For multi-codepoint characters (emoji ZWJ sequences, combining marks), this leaves the cursor mid-grapheme. `moveCursor` has the same issue.
3235
3336 ---
3437
@@ -54,5 +57,4 @@ Remaining work, known bugs, and planned improvements.
5457
5558 ## Documentation Gaps
5659
57-- 🔧 **Duplicate JSDoc** — `paintLineGraphemes` in `paint.ts` has its doc comment written twice.
58-- ❌ **No docs for uncontrolled scroll** — All examples/docs use controlled scroll (`scrollOffset` + `onScroll`). The spec's uncontrolled pattern isn't shown anywhere.
60+- ❌ **No docs for uncontrolled scroll** — All examples/docs use controlled scroll (`scrollOffset` + `onScroll`). The spec's uncontrolled pattern should be shown in SKILL.md and api.md.
packages/core/src/paint.ts+0−5
@@ -322,11 +322,6 @@ function makeCell(
322322 };
323323 }
324324
325-/**
326- * Paint a single line of text into the buffer using grapheme segmentation.
327- * Correctly handles wide characters (CJK, emoji) by advancing the column
328- * by the grapheme's visible width.
329- */
330325 /**
331326 * Paint a single line of text into the buffer using grapheme segmentation.
332327 * Correctly handles wide characters (CJK, emoji) by advancing the column
spec.md+1−1
@@ -724,7 +724,7 @@ cel.viewport(() =>
724724 bold: msg.role === "user",
725725 fgColor: msg.role === "user" ? "blue" : "green",
726726 }),
727- ...msg.blocks.map((block) => Text(` ${block.content}`)),
727+ Text(` ${msg.content}`),
728728 ]),
729729 ),
730730 ],