Skip to content

Fixes #5284. Right-clicking a link in MarkdownView adds Copy Link to context menu#5285

Merged
YourRobotOverlord merged 1 commit into
gui-cs:developfrom
YourRobotOverlord:feature/markdown-copy-link-context-menu
May 9, 2026
Merged

Fixes #5284. Right-clicking a link in MarkdownView adds Copy Link to context menu#5285
YourRobotOverlord merged 1 commit into
gui-cs:developfrom
YourRobotOverlord:feature/markdown-copy-link-context-menu

Conversation

@YourRobotOverlord

@YourRobotOverlord YourRobotOverlord commented May 9, 2026

Copy link
Copy Markdown
Collaborator
Copilot Session

[17d4aecc-2df2-4114-8f1e-0e0b0c717688]

Fixes #5284

Summary

Right-clicking on a hyperlink in the Markdown view now adds a Copy Link item to the context menu. Clicking it copies only the raw URL to the clipboard — not the display text.

Menu layout when right-clicking a link:

Copy Link        ← copies URL only
──────────
Select All
Copy

Right-clicking on a non-link area continues to show only Select All and Copy. The keyboard context menu (Shift+F10) is also unaffected.

Changes

File Change
Markdown.cs Add _contextMenuLinkUrl field; update XML doc
MarkdownView.Mouse.cs Add FindLinkUrlAt(contentX, contentY) helper that scans _linkRegions
MarkdownView.Selection.cs ShowContextMenu detects link under right-click and rebuilds menu; CreateContextMenu prepends "Copy Link" + separator when a link URL is found

Testing

  • All 334 existing Markdown unit tests pass
  • dotnet build --no-restore — 0 errors, 0 warnings

…nk to context menu

When the user right-clicks on a hyperlink in the Markdown view, the
context menu now includes a 'Copy Link' item at the top (followed by a
separator) that copies only the raw URL to the clipboard — not the
display text.

- Add _contextMenuLinkUrl field and FindLinkUrlAt helper (Mouse.cs)
- ShowContextMenu detects link under right-click position and rebuilds
  context menu accordingly (Selection.cs)
- CreateContextMenu prepends 'Copy Link' + separator when a link URL
  is detected (Selection.cs)

Keyboard context menu (Shift+F10) is unaffected.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@YourRobotOverlord YourRobotOverlord requested a review from tig as a code owner May 9, 2026 04:29
@YourRobotOverlord

Copy link
Copy Markdown
Collaborator Author
WindowsTerminal_NIemLNZS0q

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.

MarkdownView: Right-clicking a link should offer 'Copy Link' in the context menu

2 participants