[PR #14775] [MERGED] Add support for a right-click context menu #30242

Open
opened 2026-01-31 09:39:33 +00:00 by claunia · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/microsoft/terminal/pull/14775
Author: @zadjii-msft
Created: 2/2/2023
Status: Merged
Merged: 3/17/2023
Merged by: @DHowett

Base: mainHead: dev/migrie/f/3337-just-for-funsies


📝 Commits (10+)

  • eaf1a92 okay maybe I have silly free time ideas too
  • 7001e93 forwarded_event, string tests
  • eb88cd3 practical use, look
  • b535a5f I suppose this is what happens when I have four uninterrupted hours away from the kid
  • 520c89f sad beeps
  • eb7d2be I am incapable of not making 100 tiny commits, this was already way to friggin big.
  • e6b33c3 yea that's everything
  • 29d454b 90% plumbing, 10% bad implementation of making sure we right-clicked then released
  • 451d8f3 move this code to interactivity. Scaling of event is wrong now
  • 99b84a6 Merge remote-tracking branch 'origin/main' into dev/migrie/f/3337-just-for-funsies

📊 Changes

26 files changed (+322 additions, -21 deletions)

View changed files

📝 src/cascadia/TerminalApp/ColorPickupFlyout.cpp (+0 -3)
📝 src/cascadia/TerminalApp/Resources/en-US/Resources.resw (+10 -4)
📝 src/cascadia/TerminalApp/TerminalPage.cpp (+76 -0)
📝 src/cascadia/TerminalApp/TerminalPage.h (+4 -0)
📝 src/cascadia/TerminalControl/ControlInteractivity.cpp (+17 -8)
📝 src/cascadia/TerminalControl/ControlInteractivity.h (+1 -0)
📝 src/cascadia/TerminalControl/ControlInteractivity.idl (+3 -0)
📝 src/cascadia/TerminalControl/EventArgs.cpp (+1 -0)
📝 src/cascadia/TerminalControl/EventArgs.h (+10 -0)
📝 src/cascadia/TerminalControl/EventArgs.idl (+5 -0)
📝 src/cascadia/TerminalControl/IControlSettings.idl (+1 -0)
📝 src/cascadia/TerminalControl/Resources/en-US/Resources.resw (+33 -1)
📝 src/cascadia/TerminalControl/SearchBoxControl.h (+0 -2)
📝 src/cascadia/TerminalControl/TermControl.cpp (+105 -1)
📝 src/cascadia/TerminalControl/TermControl.h (+12 -0)
📝 src/cascadia/TerminalControl/TermControl.idl (+3 -0)
📝 src/cascadia/TerminalControl/TermControl.xaml (+26 -1)
📝 src/cascadia/TerminalControl/TerminalControlLib.vcxproj (+1 -0)
📝 src/cascadia/TerminalControl/dll/TerminalControl.vcxproj (+1 -0)
📝 src/cascadia/TerminalControl/pch.h (+4 -0)

...and 6 more files

📄 Description

Experimental for now. experimental.rightClickContextMenu, a per-profile setting. Long term we want to enable full mouse bindings, at which point this would be replaced.

Closes #3337

This adds two context menus to the TermControl - one for right-clicking with a selection, and one without. The implementation is designed to follows the API experience of the context menu on something like a RichEditBox. The hosting application adds a handler for the menu's Opening event, and appends whatever items it wants at that time.

So TermControl only implements a few "actions" by default - copy, past, find. TerminalApp is then responsible for adding anything else it needs. Right now, those actions are:

  • Duplicate tab
  • Duplicate pane
  • Close Tab
  • Close pane

Screenshots in https://github.com/microsoft/terminal/pull/14775#issuecomment-1415737393


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/microsoft/terminal/pull/14775 **Author:** [@zadjii-msft](https://github.com/zadjii-msft) **Created:** 2/2/2023 **Status:** ✅ Merged **Merged:** 3/17/2023 **Merged by:** [@DHowett](https://github.com/DHowett) **Base:** `main` ← **Head:** `dev/migrie/f/3337-just-for-funsies` --- ### 📝 Commits (10+) - [`eaf1a92`](https://github.com/microsoft/terminal/commit/eaf1a920e1a4d5a4ea349ed0036f3fa520709212) okay maybe I have silly free time ideas too - [`7001e93`](https://github.com/microsoft/terminal/commit/7001e93550ef6ac182b7bb6aaaf3a0acbdbe2b82) forwarded_event, string tests - [`eb88cd3`](https://github.com/microsoft/terminal/commit/eb88cd3a2d15fbf30af64a70f2ef859173388a40) practical use, look - [`b535a5f`](https://github.com/microsoft/terminal/commit/b535a5f3f359b95156119679a144e0f7ada9ce4e) I suppose this is what happens when I have four uninterrupted hours away from the kid - [`520c89f`](https://github.com/microsoft/terminal/commit/520c89f1fe236c2684f7f2a8434d7e8157e3b597) sad beeps - [`eb7d2be`](https://github.com/microsoft/terminal/commit/eb7d2be2e8c7d447b50ea2f4dae277743d4caa3d) I am incapable of not making 100 tiny commits, this was already way to friggin big. - [`e6b33c3`](https://github.com/microsoft/terminal/commit/e6b33c37400a46bc49fac2a3febbaabd418f12ad) yea that's everything - [`29d454b`](https://github.com/microsoft/terminal/commit/29d454ba4c6d2297726bd2bd1e049aab7a8f1b8b) 90% plumbing, 10% bad implementation of making sure we right-clicked then released - [`451d8f3`](https://github.com/microsoft/terminal/commit/451d8f360928105823a944258f761541fc6d84fa) move this code to interactivity. Scaling of event is wrong now - [`99b84a6`](https://github.com/microsoft/terminal/commit/99b84a60b76457253fa925cba61b546de1127d96) Merge remote-tracking branch 'origin/main' into dev/migrie/f/3337-just-for-funsies ### 📊 Changes **26 files changed** (+322 additions, -21 deletions) <details> <summary>View changed files</summary> 📝 `src/cascadia/TerminalApp/ColorPickupFlyout.cpp` (+0 -3) 📝 `src/cascadia/TerminalApp/Resources/en-US/Resources.resw` (+10 -4) 📝 `src/cascadia/TerminalApp/TerminalPage.cpp` (+76 -0) 📝 `src/cascadia/TerminalApp/TerminalPage.h` (+4 -0) 📝 `src/cascadia/TerminalControl/ControlInteractivity.cpp` (+17 -8) 📝 `src/cascadia/TerminalControl/ControlInteractivity.h` (+1 -0) 📝 `src/cascadia/TerminalControl/ControlInteractivity.idl` (+3 -0) 📝 `src/cascadia/TerminalControl/EventArgs.cpp` (+1 -0) 📝 `src/cascadia/TerminalControl/EventArgs.h` (+10 -0) 📝 `src/cascadia/TerminalControl/EventArgs.idl` (+5 -0) 📝 `src/cascadia/TerminalControl/IControlSettings.idl` (+1 -0) 📝 `src/cascadia/TerminalControl/Resources/en-US/Resources.resw` (+33 -1) 📝 `src/cascadia/TerminalControl/SearchBoxControl.h` (+0 -2) 📝 `src/cascadia/TerminalControl/TermControl.cpp` (+105 -1) 📝 `src/cascadia/TerminalControl/TermControl.h` (+12 -0) 📝 `src/cascadia/TerminalControl/TermControl.idl` (+3 -0) 📝 `src/cascadia/TerminalControl/TermControl.xaml` (+26 -1) 📝 `src/cascadia/TerminalControl/TerminalControlLib.vcxproj` (+1 -0) 📝 `src/cascadia/TerminalControl/dll/TerminalControl.vcxproj` (+1 -0) 📝 `src/cascadia/TerminalControl/pch.h` (+4 -0) _...and 6 more files_ </details> ### 📄 Description Experimental for now. `experimental.rightClickContextMenu`, a per-profile setting. Long term we want to enable full mouse bindings, at which point this would be replaced. Closes #3337 This adds **two** context menus to the `TermControl` - one for right-clicking with a selection, and one without. The implementation is designed to follows the API experience of the context menu on something like a [`RichEditBox`](winui2gallery://item/RichEditBox). The hosting application adds a handler for the menu's `Opening` event, and appends whatever items it wants at that time. So `TermControl` only implements a few "actions" by default - copy, past, find. `TerminalApp` is then responsible for adding anything else it needs. Right now, those actions are: * Duplicate tab * Duplicate pane * Close Tab * Close pane Screenshots in https://github.com/microsoft/terminal/pull/14775#issuecomment-1415737393 --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
claunia added the pull-request label 2026-01-31 09:39:33 +00:00
Sign in to join this conversation.
No Label pull-request
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#30242