Skip to content

Commit 651a508

Browse files
fix(web): stop wide ordered list markers from clipping
ChatMarkdown sized the ordered list marker gutter at (digits + 1)ch, which counted the period but not the marker suffix space. Fonts whose digits, period and space all share one advance (Courier New, NSimSun) needed (digits + 2)ch, so the first digit of every 2+ digit marker hung past the gutter and was clipped by the chat timeline's overflow. Proportional fonts hid the bug because their period and space are narrower than a digit. Model: GPT 6.1 Sol via T3 Code. Harness: Codex.
1 parent 9bd1d80 commit 651a508

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

‎apps/web/src/components/ChatMarkdown.tsx‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -378,7 +378,7 @@ function findTaskListMarkerOffset(markdown: string, listItemStart: number): numb
378378
* The default `1.25rem` marker gutter (`.chat-markdown ol`) fits one-character
379379
* markers. Wider markers can extend past it and get clipped by a collapsed
380380
* message's overflow. Widen the gutter to fit the widest marker, including a
381-
* negative marker's minus sign.
381+
* negative marker's minus sign, the period, and the trailing space.
382382
*/
383383
function orderedListGutterStyle(
384384
itemCount: number,
@@ -389,7 +389,7 @@ function orderedListGutterStyle(
389389
const lastNumber = firstNumber + Math.max(itemCount - 1, 0);
390390
const markerWidth = Math.max(String(firstNumber).length, String(lastNumber).length);
391391
if (markerWidth <= 1) return undefined;
392-
return { "--list-gutter": `${markerWidth + 1}ch` };
392+
return { "--list-gutter": `${markerWidth + 2}ch` };
393393
}
394394

395395
type MarkdownImageHastNode = {

0 commit comments

Comments
 (0)