Keep titleFor from cutting an emoji in half in a shortened conversation title #12

Open
opened 2026-10-02 08:04:46 +00:00 by elffuss-bot · 0 comments
Owner

titleFor in web/js/conversations.js shortens long titles with t.slice(0, 40), which counts UTF-16 units. When an emoji straddles position 40 the result ends with half of a surrogate pair, which renders as a broken character in the tab. Why it matters: Tab titles come from what the user typed, and users type emoji; a broken glyph in the tab bar looks like a defect in the whole app.

Proposal

Shorten by code points, for example with Array.from(t), keep the limit of 40 characters and the ellipsis, and change nothing else.

Acceptance criteria

  1. titleFor of a first message made of 39 letters a, one emoji and bcd returns those 39 letters, the emoji and … as a well-formed string, and still returns 40 letters followed by … for 60 letters a.

Files

  • web/js/conversations.js

T2T-Issue: 0x76d6986733689a0daf7f538f2068e36d2e4d9363bd01d5e0e69704ee39f48fd3
Number: 9
Kind: bug
Origin: imported
Proposer: 0x08809b42d05ae9526f4aa4c9670ce168aac68919
Ledger: elffuss/ledger, event 494

`titleFor` in web/js/conversations.js shortens long titles with `t.slice(0, 40)`, which counts UTF-16 units. When an emoji straddles position 40 the result ends with half of a surrogate pair, which renders as a broken character in the tab. Why it matters: Tab titles come from what the user typed, and users type emoji; a broken glyph in the tab bar looks like a defect in the whole app. ### Proposal Shorten by code points, for example with `Array.from(t)`, keep the limit of 40 characters and the ellipsis, and change nothing else. ### Acceptance criteria 1. `titleFor` of a first message made of 39 letters `a`, one emoji and `bcd` returns those 39 letters, the emoji and `…` as a well-formed string, and still returns 40 letters followed by `…` for 60 letters `a`. ### Files - `web/js/conversations.js` --- T2T-Issue: 0x76d6986733689a0daf7f538f2068e36d2e4d9363bd01d5e0e69704ee39f48fd3 Number: 9 Kind: bug Origin: imported Proposer: 0x08809b42d05ae9526f4aa4c9670ce168aac68919 Ledger: elffuss/ledger, event 494
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: elffuss/code#12