[PR #14807] [MERGED] Add the ability to select a whole command (or its output) #30256

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

📋 Pull Request Information

Original PR: https://github.com/microsoft/terminal/pull/14807
Author: @zadjii-msft
Created: 2/7/2023
Status: Merged
Merged: 4/20/2023
Merged by: @zadjii-msft

Base: mainHead: dev/migrie/f/4588-select-shell-output


📝 Commits (10+)

  • 5398ea3 mostly, the plumbing for this feature
  • 23f9527 this actually just selects the command+1 character
  • dbb4db3 this gets the selection region actually correct
  • d867a61 Add support for going up and down
  • e76564e this makes it less painful
  • ce6a2e7 you-donkey.png
  • 0e546a6 Merge remote-tracking branch 'origin/main' into dev/migrie/f/4588-select-shell-output
  • 35b519a use resorces
  • 2a6520d cleanup
  • 77e4289 oh boy missed a pair

📊 Changes

16 files changed (+398 additions, -20 deletions)

View changed files

📝 src/cascadia/TerminalApp/AppActionHandlers.cpp (+29 -0)
📝 src/cascadia/TerminalControl/ControlCore.cpp (+84 -0)
📝 src/cascadia/TerminalControl/ControlCore.h (+2 -1)
📝 src/cascadia/TerminalControl/ICoreState.idl (+2 -0)
📝 src/cascadia/TerminalControl/TermControl.cpp (+10 -0)
📝 src/cascadia/TerminalControl/TermControl.h (+2 -0)
📝 src/cascadia/TerminalSettingsModel/ActionAndArgs.cpp (+25 -19)
📝 src/cascadia/TerminalSettingsModel/ActionArgs.cpp (+25 -0)
📝 src/cascadia/TerminalSettingsModel/ActionArgs.h (+15 -0)
📝 src/cascadia/TerminalSettingsModel/ActionArgs.idl (+19 -0)
📝 src/cascadia/TerminalSettingsModel/AllShortcutActions.h (+4 -0)
📝 src/cascadia/TerminalSettingsModel/Resources/en-US/Resources.resw (+12 -0)
📝 src/cascadia/TerminalSettingsModel/TerminalSettingsSerializationHelpers.h (+8 -0)
📝 src/cascadia/UnitTests_Control/ControlCoreTests.cpp (+140 -0)
📝 src/terminal/adapter/DispatchTypes.hpp (+9 -0)
📝 src/terminal/adapter/adaptDispatch.cpp (+12 -0)

📄 Description

Adds two new commands, selectOutput and selectCommand. These don't do much without shell integration enabled, unfortunately. If you do enable it, however, you can use these commands to quickly navigate the history to select whole commands (or their output).

Some sample JSON:

        { "keys": "ctrl+shift+<", "command": { "action": "selectCommand", "direction": "prev" } },
        { "keys": "ctrl+shift+>", "command": { "action": "selectCommand", "direction": "next" } },
        { "keys": "ctrl+shift+[", "command": { "action": "selectOutput", "direction": "prev" } },
        { "keys": "ctrl+shift+]", "command": { "action": "selectOutput", "direction": "next" } },

Demo gifs in https://github.com/microsoft/terminal/issues/4588#issuecomment-1352042789

closes #4588

Tested manually.

CMD.exe user? It's dangerous to go alone! Take this.

Surely, there's a simpler way to do it, this is adapted from my own script.

prompt $e]133;D$e\$e]133;A$e\$e\$e]9;9;$P$e\$e[30;107m[$T]$e[97;46m$g$P$e[36;49m$g$e[0m$e[K$_$e[0m$e[94m%username%$e[0m@$e[32m%computername%$e[0m$G$e]133;B$e\

🔄 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/14807 **Author:** [@zadjii-msft](https://github.com/zadjii-msft) **Created:** 2/7/2023 **Status:** ✅ Merged **Merged:** 4/20/2023 **Merged by:** [@zadjii-msft](https://github.com/zadjii-msft) **Base:** `main` ← **Head:** `dev/migrie/f/4588-select-shell-output` --- ### 📝 Commits (10+) - [`5398ea3`](https://github.com/microsoft/terminal/commit/5398ea3aa781d886981fcf473aa7651ab83218f8) mostly, the plumbing for this feature - [`23f9527`](https://github.com/microsoft/terminal/commit/23f9527280568f52ad57b840efba3446132ca910) this actually just selects the command+1 character - [`dbb4db3`](https://github.com/microsoft/terminal/commit/dbb4db3cc8d924abf33b31790dd8c085588c0f7d) this gets the selection region actually correct - [`d867a61`](https://github.com/microsoft/terminal/commit/d867a6179fa3b23a4179241a81735d309092bfc4) Add support for going up and down - [`e76564e`](https://github.com/microsoft/terminal/commit/e76564eb9d28c3eaa05fb2114bf2e846dd8d00fc) this makes it _less_ painful - [`ce6a2e7`](https://github.com/microsoft/terminal/commit/ce6a2e79cba1eda67440b901cfc8c870c573f05a) you-donkey.png - [`0e546a6`](https://github.com/microsoft/terminal/commit/0e546a62e0c82471636d24c49393f972ac0031d9) Merge remote-tracking branch 'origin/main' into dev/migrie/f/4588-select-shell-output - [`35b519a`](https://github.com/microsoft/terminal/commit/35b519a175fd0e7fb755a4ced0106de25730c7e1) use resorces - [`2a6520d`](https://github.com/microsoft/terminal/commit/2a6520dfef0e5364e69b120cd93f1ddb85069655) cleanup - [`77e4289`](https://github.com/microsoft/terminal/commit/77e4289dcb6c55075a84a48434659c096f261e51) oh boy missed a pair ### 📊 Changes **16 files changed** (+398 additions, -20 deletions) <details> <summary>View changed files</summary> 📝 `src/cascadia/TerminalApp/AppActionHandlers.cpp` (+29 -0) 📝 `src/cascadia/TerminalControl/ControlCore.cpp` (+84 -0) 📝 `src/cascadia/TerminalControl/ControlCore.h` (+2 -1) 📝 `src/cascadia/TerminalControl/ICoreState.idl` (+2 -0) 📝 `src/cascadia/TerminalControl/TermControl.cpp` (+10 -0) 📝 `src/cascadia/TerminalControl/TermControl.h` (+2 -0) 📝 `src/cascadia/TerminalSettingsModel/ActionAndArgs.cpp` (+25 -19) 📝 `src/cascadia/TerminalSettingsModel/ActionArgs.cpp` (+25 -0) 📝 `src/cascadia/TerminalSettingsModel/ActionArgs.h` (+15 -0) 📝 `src/cascadia/TerminalSettingsModel/ActionArgs.idl` (+19 -0) 📝 `src/cascadia/TerminalSettingsModel/AllShortcutActions.h` (+4 -0) 📝 `src/cascadia/TerminalSettingsModel/Resources/en-US/Resources.resw` (+12 -0) 📝 `src/cascadia/TerminalSettingsModel/TerminalSettingsSerializationHelpers.h` (+8 -0) 📝 `src/cascadia/UnitTests_Control/ControlCoreTests.cpp` (+140 -0) 📝 `src/terminal/adapter/DispatchTypes.hpp` (+9 -0) 📝 `src/terminal/adapter/adaptDispatch.cpp` (+12 -0) </details> ### 📄 Description Adds two new commands, `selectOutput` and `selectCommand`. These don't do much without shell integration enabled, unfortunately. If you do enable it, however, you can use these commands to quickly navigate the history to select whole commands (or their output). Some sample JSON: ```json { "keys": "ctrl+shift+<", "command": { "action": "selectCommand", "direction": "prev" } }, { "keys": "ctrl+shift+>", "command": { "action": "selectCommand", "direction": "next" } }, { "keys": "ctrl+shift+[", "command": { "action": "selectOutput", "direction": "prev" } }, { "keys": "ctrl+shift+]", "command": { "action": "selectOutput", "direction": "next" } }, ``` **Demo gifs** in https://github.com/microsoft/terminal/issues/4588#issuecomment-1352042789 closes #4588 Tested manually. <details> <summary>CMD.exe user? It's dangerous to go alone! Take this.</summary> Surely, there's a simpler way to do it, this is adapted from my own script. ```cmd prompt $e]133;D$e\$e]133;A$e\$e\$e]9;9;$P$e\$e[30;107m[$T]$e[97;46m$g$P$e[36;49m$g$e[0m$e[K$_$e[0m$e[94m%username%$e[0m@$e[32m%computername%$e[0m$G$e]133;B$e\ ``` </details> --- <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:37 +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#30256