Repository navigation
Description
Before submitting
- I searched existing issues and did not find a duplicate.
- I included enough detail to reproduce or investigate the problem.
Area
apps/web
Steps to reproduce
- Open T3 Code (desktop or web) with the default rich-text composer enabled.
- Paste two paragraphs where Paragraph 1 has multiple inline Markdown spans (inline code + bold) and sits right near a line-wrap boundary, e.g.:
When `enableFeatureFlag` is enabled, only release the buffer if `group`/`model` **cannot match any active capture rule** (and does not match user or media capture); otherwise keep retaining it across subsequent retries. Question: how do we know **cannot match any active capture rule** ahead of time?
- Adjust the window/composer width if needed so Paragraph 1 fits on 2 lines when delimiters are hidden (3 lines total), and wraps to 3 lines when
`and**delimiters are revealed (4 lines total). - Hold left-click and drag-select across the inline code and bold tokens (both forward across line 1 and backward from line 2 up into the bold span on line 1), then nudge the cursor slightly left/right around the wrapped bold span before releasing the mouse button.
Expected behavior
Drag-selecting across styled inline Markdown in the composer should keep text layout stable, track the pointer smoothly without jumping or oscillating, and preserve the exact selection endpoints on mouse release.
Actual behavior
As soon as an active drag selection touches an inline code or bold range, markdownSourcePlugin (apps/web/src/composer-markdown-source.ts) synchronously inserts literal ` / ** characters into the ProseMirror document and replaces styled DOM nodes with <span class="composer-markdown-source">, then deletes/collapses them as soon as the drag moves away:
- Repeated vertical reflow jumps mid-drag: Revealing/hiding delimiters toggles Paragraph 1 between 2 and 3 lines. Because the composer grows upward from a fixed bottom anchor, the text lines jump up/down by a full line height directly underneath the stationary pointer.
- Severe cursor-vs-selection desync & oscillation: On the next
mousemove, Chromium hit-tests the fixed pointer coordinates against the shifted lines, jumping the selection to a completely different line/token and re-triggering reveal/collapse. Nudging the cursor horizontally by ~1–2 characters near the wrapped bold span causes the selection start to thrash back and forth between the start of line 1 and the end of line 1 while the cursor stays on line 2. - Anchor drift, truncated selection on
mouseup, and visual flicker: Destroying/rebuilding DOM nodes and callingtr.setSelection(mapSelection(...))while Chromium's native drag selection is active causes the drag anchor to drift, snaps/truncates the selection upon mouse release, and intermittently causes the selection highlight to flash black and the cursor to flicker to an arrow pointer.
Root cause (apps/web/src/composer-markdown-source.ts, introduced in #30421)
appendTransaction(lines 486–508) runsnormalizeMarkdownSource()on everytr.selectionSet, including continuousselectionchangeupdates during an active mouse drag.- It skips rewriting during IME composition (
if (view?.composing) return null, line 491), but has no guard for an active pointer/mouse drag (mousedown/pointerdown→mouseup/pointerup/pointercancel). touches()(lines 128–132) triggers reveal for non-empty range selections as well as collapsed carets.
Suggested fix
- Defer
normalizeMarkdownSource()while a mouse/pointer drag is in progress (similar to theview?.composingguard) and normalize once onmouseup/pointerup/pointercancel. - Even better, consider revealing editable Markdown source only for collapsed carets (
selection.empty) rather than mid-drag range selections, since dragging across styled text is typically for copying/deleting and should not reflow lines under the pointer.
Impact
Major degradation or frequent failure
Version or commit
v0.1.11 (verified unchanged on main @ 1c2770d)
Environment
macOS 26.5.1 (Apple Silicon), T3 Code Desktop 0.1.11 (Electron / Chromium)
Logs or stack traces
Screenshots, recordings, or supporting files
No response
Workaround
Switch the composer to Plain Markdown mode in Settings (disabling the rich-text composer).
Activity