Repository navigation
fix(messages): keep names in literal Markdown as written when editing - #2834
cheng-block merged 3 commits into
Conversation
Opening Edit turned every bound name into a profile link, including names inside HTML, link titles, reference definitions and code. Saving then published that link Markdown inside them, for example in a definition's URL or a link's title. The timeline and Copy skip a name that overlaps literal Markdown; Edit now does the same, with the renderer's literalRanges (exported for this) and the overlap check Copy uses. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Cheng Peng <cheng@block.xyz> Co-authored-by: Cursor <cursoragent@cursor.com>
Each linked name was checked against every literal range, so a message with many names beside code spans took up to about 270 ms to open in Edit at 32 KiB. Walk the ranges forward with the name parts, as the timeline does. The regression table now puts the linked name right beside HTML, so a check that also drops a touching name fails it. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Cheng Peng <cheng@block.xyz> Co-authored-by: Cursor <cursoragent@cursor.com>
…ions-literal-markdown * upstream/main: (38 commits) fix(composer): let Option+Up/Down switch conversations from an empty composer (block#2832) fix(reactions): Scope timed reactions to the selected video (block#2796) fix(communities): name what the Join dialog is doing instead of "Working…" (block#2822) docs(agents): explain the per-conversation MCP cost of Claude agents (block#2683) fix(avatars): keep unsaved avatar drafts and focus, and validate the URL late (block#2714) fix(agents): offer stream and forum connection setup only to channel members (block#2749) Describe Attention as what the agent does, not its tools (block#2865) Let a local Codex agent join its owner's huddle by voice (block#2321) ci: give the native job room for a cold Rust cache (block#2867) fix(pairing): refuse unknown communities natively and name the requesting process (block#2835) Add per-interest Attention pause and management controls (block#2847) feat(drafts): show where unsent drafts wait (block#2853) feat(agents): let app-hosted agents read their owner's channels and members (block#2745) NEXUS-4271: Expose installed plugin status (block#2754) fix(menu): stop clipping lifecycle actions behind a hidden scrollbar (block#2716) feat(agents): give approved external apps the selected agent's full Buzz tools (block#2707) AIDA-2549: Keep Claude settings drafts in sync (block#2841) fix(channels): keep a channel's side panels open when returning to it (block#2838) fix(builderlab): clarify remote-agent account availability (block#2764) fix(sidebar): rename Remove from Team to Close conversation (block#2845) ... Signed-off-by: Cheng Peng <cheng@block.xyz> Co-authored-by: Cursor <cursoragent@cursor.com>
|
🤖 No design blockers found at Source review only; no screenshots supplied. I did not run tests or exercise live edit/save, keyboard/focus, themes, window widths, enlarged text, or long/empty/loading/error/many-agent rendering. |
|
🤖 Could you add a screenshot or short video of the change to the PR? Design uses these for faster reviews. |
Added under Screenshots in the description. They come from the debug build I tested. |
|
Hi there, can you please stop mentioning my GH Account as I am not related to this project. |
Sorry about that. BeeBee is the name of my Buzz test agent, and the PR text wrote it with an @. I changed those to code format here and in the other PRs, so they will not ping you again. |
main's literal Markdown ranges (block#2834) already skip reference definitions when an edit turns names back into links, so take main's messageEditText and keep both test sets. Signed-off-by: Cheng Peng <cheng@block.xyz> Co-authored-by: Cursor <cursoragent@cursor.com>
Why
Edit turns a name inside literal Markdown (HTML, link titles, reference definitions) into a mention link, so saving changes text you never touched.
[ref]: https://example.com "Ask @Sam"is saved as[ref]: https://example.com "Ask [@Sam](nostr:npub1…)". The timeline and Copy show those names as plain text.messageEditTextlinks every nameprofileMentionPartsfinds, and that finder skips only code, links and URLs (src/features/messages/profile-mentions.ts:99). The timeline drops a name that overlaps a range fromliteralRanges(src/features/messages/markdown-preparation.ts:39). Edit had no such check.What
Edit now leaves a name as written when it sits inside literal Markdown, using the timeline's ranges. Names outside literal Markdown still become mention links.
How
messageEditTextparses the text it edits (sourceContent, which keeps attachment Markdown) withscanMarkdownand takesliteralRanges(tree, true).literalRangesis now exported.Risk
Low. Only the text Edit loads changes. Recipients stay the same: an edited message keeps the original event's
ptags, so a name left as text drops no one.[Hi @Sam]\(https://example.com)into a link and shows no mention. Edit and Copy read it as written and still link that@Sam, same as onmain.protectedTextEndtime on unmatched brackets.[ref]: https://example.com/a,@Samstays as written.Testing
main, Edit linked more than Copy on 20.messageEditTextruns once when Edit opens (Node and jsdom, median of five runs). A body that alternates names and code spans took about 72 ms at 16,000 characters and 270 ms at 32 KiB before the in-order check. After it, 8 ms and 16 ms.Screenshots
Debug build of this PR: Edit shows the real mention as a chip and leaves
@BeeBeeinside the span title as plain text.<img width="760" alt="Composer in Editing message mode with Hi
@BeeBeeon line one and a literal span tag with title "@BeeBee" below." src="https://github.com/user-attachments/assets/26434d42-f342-4007-a9b3-382d1627742e" />After saving, the message keeps the real mention and the literal span exactly as written.
In-app check
Verified in the macOS app by Cheng.
Build: this PR at
bcc62911e, merged locally with my other open PRs ontomainatc037057a1, run as a debug app bundle. Later commits only mergemain.Use a test channel with a person or agent in it. The steps call them Name.
Hi @, pick Name, press Shift+Enter twice, then paste<span title="@Name">hi</span>with their exact name. Send.Hi, the mention, then<span title="@Name">hi</span>as typed.<span title="@Name">hi</span>. Onmain, Edit put a profile link inside the quotes.HitoHelloand save. The message showsHello, the mention, and the same<span>line.buzz-review-completed