Stop titleFor from cutting an emoji in half when it shortens a conversation title #6
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 conversation whose first user message is 39 lettersa, then one emoji, thenbcdreturns a string for whichisWellFormed()is true.titleForof a conversation whose first user message has 60 ASCII letters returns 40 letters followed by the ellipsis character.titleForof a conversation with an empty history returns the same string as the base version.Files
web/js/conversations.jsT2T-Issue: 0x7e899124e8af5d3ab2f4e029ffb980d0a5d7b5b2828b17f6c4e17a836ca763fa
Number: 6
Kind: bug
Origin: imported
Proposer: 0x08809b42d05ae9526f4aa4c9670ce168aac68919
Ledger: elffuss/ledger, event 121