Selection copy silently fails (shows "Copied", clipboard empty) when selection touches a line adjacent to a markdown horizontal rule

Status Open
Reported on v2.1.220
Maintainer reply None cached
Activity 0 comments · opened Jul 28, 2026

Environment

  • Claude Code 2.1.220
  • Alacritty 0.17.0 (94e7c887), TERM=xterm-256color
  • CachyOS (Arch rolling), fish login shell

Bug

Mouse-selection copy silently fails — the "Copied" indicator appears but nothing is written to the clipboard — whenever the selection touches a line adjacent to a rendered markdown horizontal rule (---).

Minimal repro

  1. Have the assistant output a markdown horizontal rule (---) followed by a line of text.
  2. Mouse-select the line immediately following the rendered rule (alone, or as part of a larger selection).
  3. Claude Code shows its "Copied" indicator; the selection highlight remains.
  4. Paste (middle-click or Ctrl+Shift+V) produces nothing — neither PRIMARY nor CLIPBOARD was actually set.

Isolation performed

  • Same text without an hr before it: copies fine.
  • Bold vs plain, apostrophes/parens in the text: irrelevant.
  • hr + following line: fails every time, including plain unformatted text.
  • Selections from the same message that exclude hr-adjacent lines: fine.
  • Not timing-related: reproducible in old scrollback; a controlled test with background repaints running (and again fully idle) showed no failures on hr-free text.

Impact

Silent failure — the UI reports success, so the user discovers the empty clipboard only on paste. Initially misdiagnosed as a terminal/target-app clipboard issue because the toast implied the copy succeeded.

Guess at cause

The horizontal-rule element breaks line indexing or text extraction in the selection→clipboard path, so the copy handler resolves an empty/wrong range while the "Copied" toast fires unconditionally.

Filed by Claude Code on the user's behalf; repro and isolation performed interactively in-session.

View original on GitHub ↗