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 a project containing a long text or Markdown file (200+ lines, e.g.
AGENTS.md).
- Open the file in the right-hand Files panel in its default editable source view (
EditableFileSurface).
- Click and drag downward (or upward) to select text while scrolling past the virtualizer's 50-line window boundary (e.g. start around line 65 and drag down past line 150, or start around line 5 and drag down past line 150).
- Release the mouse and press Cmd/Ctrl+C.
Expected behavior
The drag selection stays continuous as the virtualizer shifts its mounted row window, the editor selection overlay highlights every selected line in view, and copying returns the full dragged range from the starting line to the pointer's final position.
Actual behavior
Every time <Virtualizer> shifts renderRange (every 50 lines scrolled), File.render() runs applyRowsToDOM() → Editor.__captureFocusForDOMReplacement() and Editor.__syncRenderView(), which does not check #isContentMouseDown:
- When the anchor line is still mounted in the new window (e.g. dragging from line 65 as the window shifts
1..150 → 51..200): #restoreReplacementFocus() / this.focus() calls #setWindowSelection({ start: pos, end: pos, direction: 0 }), collapsing the browser's active drag selection to a single caret. Chromium aborts the ongoing drag and restarts a fresh selection from the current pointer position on subsequent movement, repeating every 50 lines.
- When the anchor line unmounts on a window shift (e.g. dragging from line 5 as the window shifts
1..150 → 51..200): #restoreReplacementFocus() returns early when #getLineElement(primaryPosition.line) == null without clearing #focusRequest. Because #canReadNativeSelection() requires #focusRequest == null, all subsequent selectionchange events are ignored until the next pointerdown. Since the editor hides native ::selection (#0000) and paints only [data-selection-range], the selection highlight freezes and vanishes as you keep scrolling, and Cmd/Ctrl+C only copies up to the freeze point.
- Even without
#focusRequest, selectionchange reads only the currently mounted DOM range without preserving the off-screen #selectionStart anchor once its row is unmounted.
Related: #15927 fixed virtualized selection/copying for the read-only Files preview (ReadOnlySourcePreview / SourceSelection), and #30825 tracks the read-only Diff panel. This report is specifically for the editable Files preview (EditableFileSurface / @pierre/diffs Editor).
Impact
Major degradation or frequent failure
Version or commit
main @ 272cd38
Environment
macOS, T3 Code web dev app (vp run dev, Chromium) and T3 Code Desktop
Logs or stack traces
Measured on main @ 272cd38379 dragging AGENTS.md from line 65 to line 145 (scrollTop 7268, mounted lines 101..217):
- overlayRanges: 95 (frozen at line 115; lines 132..145 in viewport have 0 visible selection highlight)
- copiedLines: 51 (8,676 chars, truncated at line 115 instead of continuing through line 145)
Screenshots, recordings, or supporting files

before.mp4
Workaround
Toggle Show rendered markdown (eye icon) for .md files, or open the file in an external editor.