Skip to content

fix: exclude source annotations from text selection in debug console#308925

Open
yogeshwaran-c wants to merge 1 commit intomicrosoft:mainfrom
yogeshwaran-c:fix/debug-repl-copy-source-annotation
Open

fix: exclude source annotations from text selection in debug console#308925
yogeshwaran-c wants to merge 1 commit intomicrosoft:mainfrom
yogeshwaran-c:fix/debug-repl-copy-source-annotation

Conversation

@yogeshwaran-c
Copy link
Copy Markdown
Contributor

Summary

  • Fixes source location annotations (e.g. repl:1) being included in clipboard text when selecting and copying multi-line output from the Debug Console
  • Adds user-select: none to the .source element in the REPL tree so the annotation is excluded from native text selections while remaining visible and clickable

Root cause

The REPL tree enables text selection on .monaco-tl-contents via user-select: text. The source annotation (rendered by SourceWidget as a .source element) lives inside the same flex container (.value-and-source) as the output value. When a user selects text across multiple output lines, the browser's native selection includes the source annotation text, causing strings like repl:1 to appear in the pasted result.

Test plan

  • Start a debug session and hit a breakpoint
  • In the Debug Console, run console.log('hello \n there')
  • Select the multi-line "hello there" output text
  • Copy and paste — verify the result is hello \n there without repl:1 inserted
  • Verify the source annotation is still visible and clickable (opens the source location)

Fixes #275702

The source location annotation (e.g. 'repl:1') in the debug console
output was included in native text selections, causing it to appear
in copied text when selecting across multiple output lines.

Add user-select: none to the .source element so the source annotation
is excluded from text selection while remaining visible and clickable.

Fixes microsoft#275702
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

text copied from debug repl has repl:1 inserted

2 participants