Repository navigation
fix(composer): keep ~ in typed inline code spans - #3014
Merged
Merged
Conversation
bwester
force-pushed
the
fizz/fix-code-span-tilde
branch
from
November 8, 2026 22:59
39ba5fd to
7508a80
Compare
…de in code spans Adds tests for live conversion of bold, italic, strike and code spans and for the cases that must stay literal. Includes regression cases for code spans whose content contains ~ (e.g. `~/Foo/bar`), which currently lose two characters from each end. Those cases fail until the follow-up fix. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Signed-off-by: Benjamin Wester <bwester@squareup.com> Co-authored-by: Fizz <30bc1d8f89bd966e75f929d7650e158428987f12c19aa19ece4a8b087a4aecf3@buzz.block.builderlab.xyz>
Typing the closing backtick of `~/Foo/bar` converted it to "/Foo/ba". The span delimiter length was read with /^[`~]+/, so a ~ directly after the opening backtick counted as delimiter and two characters were trimmed from each end. Count only the backtick run for code spans and only ~ for strikethrough. Introduced with live Markdown conversion in e89d48c (#455). Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Signed-off-by: Benjamin Wester <bwester@squareup.com> Co-authored-by: Fizz <30bc1d8f89bd966e75f929d7650e158428987f12c19aa19ece4a8b087a4aecf3@buzz.block.builderlab.xyz>
bwester
force-pushed
the
fizz/fix-code-span-tilde
branch
from
November 9, 2026 02:41
7508a80 to
1908627
Compare
bwester
marked this pull request as ready for review
November 9, 2026 03:02
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Typing the closing backtick of an inline code span whose content starts with
~dropped characters.`~/Foo/bar`became/Foo/ba,`~foo`becamefo. The timeline then rendered the stray tildes as GFM strikethrough, which is why affected messages also showed struck-through text.Cause
spanOfincomposer-inline-input.tsmeasured a span's delimiter with/^[`~]+/for every span type that isn't strong or emphasis. For an inline code span the raw text begins with the backtick, so a~right after it was counted as delimiter. The conversion removed two characters from each end. A~can't be a code delimiter, and a backtick can't be a strikethrough delimiter.Introduced with live Markdown conversion in e89d48c (#455). It first shipped in
desktop-v0.7.0-beta.1, so builds from before 2026-10-02 are unaffected.Change
Count only the backtick run for code spans, and only
~for strikethrough (newdeletecase). Production diff: 6 added lines, 1 removed.Tests
New
composer-inline-input.test.ts(28 cases) calls the realapplyComposerInlineInput:~, and a non-delimiter typed after a span has converted.~(`~foo`,`~/A`,`~/Foo/bar`,`~A`,`~`,`~~`,`~~x~~`, in running text, mid-text, double-backtick delimiter).Fail-then-pass: against unfixed
main, 10 of 28 fail (all tilde-in-code); with the fix, all 28 pass. ThemessagesVitest suite passes (99 files, 2944 tests), andtsc --noEmit, biome and the commit hooks are clean.Review and validation
AGENTS.md"Reviewing"; no blocking findings (optional suggestions only: a nested-span test, a rename of one test).`~/Foo/bar`keeps the text intact; the same input loses~and the last character on the unfixed release build and the merge-base commit.buzz-review-completed
🤖 Generated with Claude Code