Text chat 8: Inline-flow text and emoji images (#258) #296
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "textchat-8-ui-inline-flow-emoji"
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?
Stacked on: textchat-4-emoji-crate, textchat-7-platform-files-clipboard
What
fluxer-core::media_urls:custom_emoji(&endpoints, id, animated, size),sticker(&endpoints, id, animated, size),twemoji(&endpoints, surrogates)(strings ofbuildCustomEmojiURL,getStickerURL,EmojiUtils.getEmojiURL). fluxer-core gains thefluxer-emojidependency (the one the plan allows) for Twemoji code points.fluxer-ui::widgets::inline_flow:InlineFlow::new(runs)withRun::{Text, Box, Break}; breaks at word boundaries and between CJK characters, cuts overlong words, boxes on the baseline (vertical-align: -0.4em), lines grow to hold them, layout cached per width (LayoutCache), word widths cached for the paragraph's life. Clickable text runs (links, spoilers).fluxer-ui::widgets::emoji:EmojiRef,view,url,wanted, andparser_context(content), a port ofbuildEmojiContext(S/C/K lines from thefluxer-emojidataset) so the fork's parser makes:name:,:name::skin-tone-N:and Unicode emoji intoNode::Emoji(©/™/® stay text).rich_text:SpanModel::emoji,is_jumbo,wanted/wanted_animated,flow_shapes; paragraphs with emoji are drawn by the flow at 1.5 em (3 rem jumbo) whenRenderCtx::emojiis set;media::wantedrequests the open channel's emoji (animated ones whenanimate_emoji).docs/superpowers/research/2026-11-12-textchat-spikes.md§1. 120basicmessages lay out in < 2 ms cold (median 12 µs, p99 59 µs), ~0.2 ms after a resize; no fallback needed.Deviations from the plan
emoji::view(&EmojiRef, size, &EmojiImages, animate): the third argument isEmojiImages { images, endpoints, elapsed }instead of&Images, because the URL needs the endpoints and an animated frame needs the clock.Run::Texthas extra fieldsunderline,strikethrough,on_press(links/spoilers) andcolor: Option<Color>;Run::text(..)builds a plain one.RenderCtxgainsemoji: Option<EmojiImages>andanimate_emoji: bool(callers updated).Tests
crates/fluxer-ui/tests/inline_flow.rs: wraps_text_and_boxes_at_width, box_baseline_aligns_with_text, layout_cached_per_width, custom_and_unicode_emoji_become_boxes, shortcode_in_text_becomes_emoji_node, jumbo_only_for_emoji_only_messages, wanted_lists_twemoji_and_custom_urls, mention_pill_has_background; ignoredspike_layout_cost(measurement).crates/fluxer-core/tests/media_urls.rs: custom emoji, sticker and Twemoji URL tests.rich_text_emoji,rich_text_jumbo(stand-in SVGs for Twemoji). Goldens were written on this machine's GPU, not lavapipe (not installed); existing goldens are unchanged and passed here. No Electron side-by-side attached: reviewer please compare with an Electron message containing emoji.FLUXER_SCREENSHOT_TESTS=1 cargo xtask cigreen locally. No desktop-only tests in this task.#40
Verified on the base:
LinkClicked->UserAction::OpenUrl->Effect::OpenUrl(runtime opens it),SpoilerToggledtoggles per-message state inmessages::State,utc_offset/now_unixset by the shell. Nothing left to do.Closes #258
Closes #40
🤖 Generated with Claude Code
Independent review: Text chat 8 (inline flow and emoji images)
Scope:
git diff 5c3660d..origin/textchat-8-ui-inline-flow-emoji(commitsc7cd884and9fe1330). The branch merges cleanly into the currentorigin/textchat.Verdict: approved. 0 blocking findings, 4 minor. Local
FLUXER_SCREENSHOT_TESTS=1 cargo xtask ciis green (exit 0).Checks
crates/fluxer-ui/tests/inline_flow.rsand assert what the plan describes. The screenshotsrich_text_emojiandrich_text_jumbohave goldens and rows indocs/screenshots/README.md.spike_layout_costis#[ignore](it measures). I checked the values against the fork.--emoji-size-emoji: 1.5emand--emoji-size-jumbo-emoji: 3remcome fromglobals.css:198-199.--markup-inline-emoji-baseline-shift: -0.4emcomes fromMarkup.module.css:9, which is 6.4 px at 16 px.CUSTOM_EMOJI_IMAGE_RUNGis 128 andCUSTOM_EMOJI_ENLARGED_IMAGE_RUNGis 240. The sticker size is 320 or 160 andsizecomes beforeanimated. The Twemoji URL is{static}/emoji/{cp}.svg?v=2. All match.InlineFlow::new(Vec<Run>)exists.Run::{Text, Box{width,height,baseline_shift,content}, Break}exists.EmojiRef::{Unicode(String), Custom{id,name,animated}}exists.rich_text::wanted(&nodes, &endpoints) -> Vec<Url>exists.media_urls::{custom_emoji, sticker, twemoji}take(&endpoints, id, animated, size)and(&endpoints, surrogates). Each of these is written as the plan states. The deviations are documented in the PR, the README and spikes §1, and later tasks will build on the merged code. See minor 1.fluxer-emoji, and the core-isolation check passes.Images/ImageLoader.well_known.jsonis reused.match_surrogatesandshortcodesslice only on char boundaries. Inplace_word, the long-word cut always makes progress, andboundsis never empty. Custom emoji ids that fail to parse are dropped.parse_messagestill falls back to plain text when it fails. In the widget,runs[fragment.run]is protected by the shape-key reset indiff.messages.rs:206-209andprofile_popout.rs:345handleLinkClickedandSpoilerToggled.buildEmojiContext: it uses byte offsets and lengths likeMarkdownParserWasm.ts:244-294(Utf8OffsetTracker). It handlesPLAINTEXT_SYMBOLS,SPECIAL_SHORTCODES, the C/K lines and the shortcode regex scan the same way.Findings
emoji::viewtakes&EmojiImages{images,endpoints,elapsed}instead of the plan's&Images, andRun::Texthas extra fields. Both are documented and reasonable. Tasks 22/24/25/27 must use the merged signatures.fluxer_ui::widgets::emoji::EmojiRefwill exist next to the coreEmojiRefthat Text chat 10 introduces (used byPickEmojiandReactionModel). The UI cannot depend on a core type that does not exist yet, so this is expected. Text chat 10/24 should add aFromconversion, or have the UI re-export the core type once it lands, so there are not two diverging enums.rich_text_emoji.pngandrich_text_jumbo.pngwere drawn on a local GPU, not on lavapipe. This machine has no lavapipe ICD either, so I could not check them. The existing lavapipe goldens pass on GPU within tolerance, so these probably pass on the runner. The integrator must confirm on the Linux runner, and regenerate them there withUPDATE_GOLDEN=1if they fail.is_shortcode_charuseschar::is_alphanumeric(Alphabetic + Numeric). That is slightly broader than[\p{L}\p{N}_-], because it also accepts Other_Alphabetic marks. The only effect is an extra C-line lookup that finds nothing. It cannot affect output for real emoji names.No Electron side-by-side is attached (the PR says so). Follow-up #295 (RTL and bios) is linked.
CI
FLUXER_SCREENSHOT_TESTS=1 cargo xtask ciin a clean review worktree at9fe1330exited 0. That covers fmt, clippy, deny, core isolation, parity, all tests and the screenshot tests, including the two new ones. I did not check the remote runners.