Keep titleFor from cutting an emoji in half in a shortened conversation title #12
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
titleForin web/js/conversations.js shortens long titles witht.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
titleForof a first message made of 39 lettersa, one emoji andbcdreturns those 39 letters, the emoji and…as a well-formed string, and still returns 40 letters followed by…for 60 lettersa.Files
web/js/conversations.jsT2T-Issue: 0x76d6986733689a0daf7f538f2068e36d2e4d9363bd01d5e0e69704ee39f48fd3
Number: 9
Kind: bug
Origin: imported
Proposer: 0x08809b42d05ae9526f4aa4c9670ce168aac68919
Ledger: elffuss/ledger, event 494