terminal/src/cascadia/TerminalApp
Mike Griese 6268a4779c
Implement and action for manually clearing the Terminal (and conpty) buffer (#10906)
## Summary of the Pull Request

![clear-buffer-000](https://user-images.githubusercontent.com/18356694/127570078-90c6089e-0430-4dfc-bcd4-a0cde20c9167.gif)

This adds a new action, `clearBuffer`. It accepts 3 values for the `clear` type:
* `"clear": "screen"`: Clear the terminal viewport content. Leaves the scrollback untouched. Moves the cursor row to the top of the viewport (unmodified).
* `"clear": "scrollback"`: Clear the scrollback. Leaves the viewport untouched.
* `"clear": "all"`: (**default**) Clear the scrollback and the visible viewport. Moves the cursor row to the top of the viewport (unmodified).

"Clear Buffer" has also been added to `defaults.json`.

## References
* From microsoft/vscode#75141 originally

## PR Checklist
* [x] Closes #1193
* [x] Closes #1882
* [x] I work here
* [x] Tests added/passed
* [ ] Requires documentation to be updated

## Detailed Description of the Pull Request / Additional comments

This is a bit tricky, because we need to plumb it all the way through conpty to clear the buffer. If we don't, then conpty will immediately just redraw the screen. So this sends a signal to the attached conpty, and then waits for conpty to draw the updated, cleared, screen back to us.

## Validation Steps Performed
* works for each of the three clear types as expected
* tests pass.
* works even with `ping -t 8.8.8.8` as you'd hope.
2021-09-02 14:59:42 +00:00
..
dll Revert "Upgrade to Microsoft.UI.Xaml 2.6.2 (or equivalent) (#10996)" (#11031) 2021-08-24 17:46:12 -05:00
Resources/en-US Allow exporting terminal buffer into file via tab context menu (#11062) 2021-08-31 19:36:43 +00:00
ActionPaletteItem.cpp Add a simple page for keybindings (#9253) 2021-02-23 23:37:23 +00:00
ActionPaletteItem.h Replace some of our macros to reduce confusion, increase success (#9376) 2021-03-04 11:27:03 -08:00
ActionPaletteItem.idl Teach CommandPalette model to natively support tabs and command lines (#8420) 2020-12-10 00:36:28 +00:00
ActionPreviewHandlers.cpp Introduce ActionMap to Terminal Settings Model (#9621) 2021-05-04 21:50:13 -07:00
App.base.h Fix some places where we weren't using winrt::make (#10335) 2021-06-04 22:22:06 +00:00
App.cpp Make Terminal look great in High Contrast (#6833) 2020-07-08 12:08:08 -07:00
App.h Break everything out of App except Xaml platform init (#3465) 2019-11-07 13:10:58 -08:00
App.idl Fix intellisense errors by moving TerminalApp projects around (#6897) 2020-08-20 22:44:37 +00:00
App.xaml Make TabView padding equal (#11115) 2021-09-02 14:34:03 +00:00
AppActionHandlers.cpp Implement and action for manually clearing the Terminal (and conpty) buffer (#10906) 2021-09-02 14:59:42 +00:00
AppCommandlineArgs.cpp Add first pane movement for MoveFocus/SwapPane. (#11044) 2021-08-26 17:58:56 +00:00
AppCommandlineArgs.h Move Pane to Tab (GH7075) (#10780) 2021-08-12 16:41:17 +00:00
AppKeyBindings.cpp Adding/fixing Alt+Space handling (#10799) 2021-08-10 19:53:07 +00:00
AppKeyBindings.h Adding/fixing Alt+Space handling (#10799) 2021-08-10 19:53:07 +00:00
AppKeyBindings.idl Introduce ActionMap to Terminal Settings Model (#9621) 2021-05-04 21:50:13 -07:00
AppLogic.cpp Add Minimize to Tray and Tray Icon (#10368) 2021-08-12 19:54:39 +00:00
AppLogic.h Add Minimize to Tray and Tray Icon (#10368) 2021-08-12 19:54:39 +00:00
AppLogic.idl Add Minimize to Tray and Tray Icon (#10368) 2021-08-12 19:54:39 +00:00
ColorHelper.cpp Fix a few minor typos from #3789 (#5740) 2020-05-04 16:47:29 -05:00
ColorHelper.h Add support for setting a tab's color at runtime w/ context menu (#3789) 2020-05-04 20:57:12 +00:00
ColorPickupFlyout.cpp Fix color picker minimum width (#10663) 2021-07-15 14:39:25 +00:00
ColorPickupFlyout.h Terminal color picker tweaks (#10219) 2021-06-10 15:49:52 +00:00
ColorPickupFlyout.idl Add support for setting a tab's color at runtime w/ context menu (#3789) 2020-05-04 20:57:12 +00:00
ColorPickupFlyout.xaml Terminal color picker tweaks (#10219) 2021-06-10 15:49:52 +00:00
Commandline.cpp Add support for commandline args to wt.exe (#4023) 2020-01-27 15:34:12 +00:00
Commandline.h Add support for commandline args to wt.exe (#4023) 2020-01-27 15:34:12 +00:00
CommandLinePaletteItem.cpp Teach CommandPalette model to natively support tabs and command lines (#8420) 2020-12-10 00:36:28 +00:00
CommandLinePaletteItem.h Replace some of our macros to reduce confusion, increase success (#9376) 2021-03-04 11:27:03 -08:00
CommandLinePaletteItem.idl Teach CommandPalette model to natively support tabs and command lines (#8420) 2020-12-10 00:36:28 +00:00
CommandPalette.cpp Teach Command Palette to filter out duplicate command lines (#11116) 2021-09-02 03:03:52 +00:00
CommandPalette.h Teach CommandPalette to persist recent command lines (#11030) 2021-08-26 19:04:35 +00:00
CommandPalette.idl Introduce ActionMap to Terminal Settings Model (#9621) 2021-05-04 21:50:13 -07:00
CommandPalette.xaml Revert "Add the profile, page icons to the page headers (#10046)" (#10124) 2021-05-18 17:35:50 -05:00
DebugTapConnection.cpp Switch Connections to use ValueSets to initialize them (#10184) 2021-07-20 15:02:17 +00:00
DebugTapConnection.h Switch Connections to use ValueSets to initialize them (#10184) 2021-07-20 15:02:17 +00:00
EmptyStringVisibilityConverter.cpp Add some polish to nested commands in the command palette (#7299) 2020-08-18 19:32:17 +00:00
EmptyStringVisibilityConverter.h Change backslashes in include statements to forward slashes (#8205) 2020-11-25 21:02:10 +00:00
EmptyStringVisibilityConverter.idl Add some polish to nested commands in the command palette (#7299) 2020-08-18 19:32:17 +00:00
FilteredCommand.cpp Teach CmdPal search to use user locale (#9943) 2021-05-04 23:31:15 +00:00
FilteredCommand.h Replace some of our macros to reduce confusion, increase success (#9376) 2021-03-04 11:27:03 -08:00
FilteredCommand.idl Teach CommandPalette model to natively support tabs and command lines (#8420) 2020-12-10 00:36:28 +00:00
HighlightedText.cpp Bold matching text in the command palette (#7977) 2020-11-05 17:37:45 -08:00
HighlightedText.h Replace some of our macros to reduce confusion, increase success (#9376) 2021-03-04 11:27:03 -08:00
HighlightedText.idl Bold matching text in the command palette (#7977) 2020-11-05 17:37:45 -08:00
HighlightedTextControl.cpp Bold matching text in the command palette (#7977) 2020-11-05 17:37:45 -08:00
HighlightedTextControl.h Bold matching text in the command palette (#7977) 2020-11-05 17:37:45 -08:00
HighlightedTextControl.idl Bold matching text in the command palette (#7977) 2020-11-05 17:37:45 -08:00
HighlightedTextControl.xaml Auto-format our XAML files and enforce in CI (#9589) 2021-03-29 17:09:38 -05:00
IDirectKeyListener.idl Pass the scancode in our tunneled DirectKey event (#7298) 2020-08-14 23:44:39 +00:00
init.cpp Hook up the WIL fallback error tracer in Terminal (#7864) 2020-10-09 22:20:12 +00:00
Jumplist.cpp Fix crash when unpackaged due to PrimaryLanguageOverride (#10434) 2021-06-16 21:08:14 +00:00
Jumplist.h Move jumplist creation to background thread (#7978) 2020-10-22 17:17:26 -07:00
LanguageProfileNotifier.cpp Reload settings when the input method changes (#10876) 2021-08-05 21:33:44 +00:00
LanguageProfileNotifier.h Reload settings when the input method changes (#10876) 2021-08-05 21:33:44 +00:00
MinMaxCloseControl.cpp Move events out of TermControl.h ; Use TYPED_EVENT in more places (#9526) 2021-03-18 22:02:39 +00:00
MinMaxCloseControl.h Move events out of TermControl.h ; Use TYPED_EVENT in more places (#9526) 2021-03-18 22:02:39 +00:00
MinMaxCloseControl.idl Fix intellisense errors by moving TerminalApp projects around (#6897) 2020-08-20 22:44:37 +00:00
MinMaxCloseControl.xaml Make TabView padding equal (#11115) 2021-09-02 14:34:03 +00:00
packages.config Revert "Upgrade to Microsoft.UI.Xaml 2.6.2 (or equivalent) (#10996)" (#11031) 2021-08-24 17:46:12 -05:00
PaletteItem.cpp Rename Microsoft.Terminal.TerminalControl to .Control; Split into dll & lib (#9472) 2021-03-17 20:47:24 +00:00
PaletteItem.h Replace some of our macros to reduce confusion, increase success (#9376) 2021-03-04 11:27:03 -08:00
PaletteItem.idl Teach CommandPalette model to natively support tabs and command lines (#8420) 2020-12-10 00:36:28 +00:00
PaletteItemTemplateSelector.cpp Add help text to 'more options' in command palette (#9271) 2021-02-24 12:02:09 -08:00
PaletteItemTemplateSelector.h Replace some of our macros to reduce confusion, increase success (#9376) 2021-03-04 11:27:03 -08:00
PaletteItemTemplateSelector.idl Add help text to 'more options' in command palette (#9271) 2021-02-24 12:02:09 -08:00
Pane.cpp Maintain zoom when moving focus (#11046) 2021-09-02 14:36:17 +00:00
Pane.h Maintain zoom when moving focus (#11046) 2021-09-02 14:36:17 +00:00
Pane.LayoutSizeNode.cpp Snap to character grid when resizing window (#3181) 2020-01-08 13:19:23 -08:00
pch.cpp Initial release of the Windows Terminal source code 2019-05-02 15:29:04 -07:00
pch.h Allow exporting terminal buffer into file via tab context menu (#11062) 2021-08-31 19:36:43 +00:00
SettingsTab.cpp In specific scenarios, focus the active control (#10048) 2021-05-11 23:55:49 +00:00
SettingsTab.h In specific scenarios, focus the active control (#10048) 2021-05-11 23:55:49 +00:00
SettingsTab.idl Add a keybinding option to Terminal to open the Settings UI (#8048) 2020-12-11 13:47:10 -08:00
ShortcutActionDispatch.cpp Add X Macro for fun and for profit (#9667) 2021-03-31 16:38:25 +00:00
ShortcutActionDispatch.h Add X Macro for fun and for profit (#9667) 2021-03-31 16:38:25 +00:00
ShortcutActionDispatch.idl Add X Macro for fun and for profit (#9667) 2021-03-31 16:38:25 +00:00
TabBase.cpp In specific scenarios, focus the active control (#10048) 2021-05-11 23:55:49 +00:00
TabBase.h In specific scenarios, focus the active control (#10048) 2021-05-11 23:55:49 +00:00
TabBase.idl Introduce read-only panes (#8867) 2021-02-08 18:03:55 +00:00
TabHeaderControl.cpp Don't yeet focus to the control when the tab renamer is opened (#10114) 2021-05-18 18:48:57 +00:00
TabHeaderControl.h Don't yeet focus to the control when the tab renamer is opened (#10114) 2021-05-18 18:48:57 +00:00
TabHeaderControl.idl Don't yeet focus to the control when the tab renamer is opened (#10114) 2021-05-18 18:48:57 +00:00
TabHeaderControl.xaml Auto-format our XAML files and enforce in CI (#9589) 2021-03-29 17:09:38 -05:00
TabManagement.cpp Allow exporting terminal buffer into file via tab context menu (#11062) 2021-08-31 19:36:43 +00:00
TabPaletteItem.cpp Fix ATS tab status indicators (#9076) 2021-02-10 11:27:29 +00:00
TabPaletteItem.h Replace some of our macros to reduce confusion, increase success (#9376) 2021-03-04 11:27:03 -08:00
TabPaletteItem.idl Fix ATS tab status indicators (#9076) 2021-02-10 11:27:29 +00:00
TabRowControl.cpp Set drag and drop on '+' tooltip text based on keyboard modifiers (#10841) 2021-08-02 18:44:39 +00:00
TabRowControl.h implement drag&drop path in '+' button (#10073) (#10160) 2021-07-20 14:26:35 +00:00
TabRowControl.idl Upgrade to Microsoft.UI.Xaml 2.2 (#3027) 2019-10-14 22:41:43 -07:00
TabRowControl.xaml implement drag&drop path in '+' button (#10073) (#10160) 2021-07-20 14:26:35 +00:00
TaskbarState.cpp Combine progress states in the tab, taskbar (#10755) 2021-08-10 11:16:17 +00:00
TaskbarState.h Combine progress states in the tab, taskbar (#10755) 2021-08-10 11:16:17 +00:00
TaskbarState.idl Combine progress states in the tab, taskbar (#10755) 2021-08-10 11:16:17 +00:00
TerminalAppLib.vcxproj Revert "Upgrade to Microsoft.UI.Xaml 2.6.2 (or equivalent) (#10996)" (#11031) 2021-08-24 17:46:12 -05:00
TerminalAppLib.vcxproj.filters Reload settings when the input method changes (#10876) 2021-08-05 21:33:44 +00:00
TerminalPage.cpp Maintain zoom when moving focus (#11046) 2021-09-02 14:36:17 +00:00
TerminalPage.h Allow exporting terminal buffer into file via tab context menu (#11062) 2021-08-31 19:36:43 +00:00
TerminalPage.idl Combine progress states in the tab, taskbar (#10755) 2021-08-10 11:16:17 +00:00
TerminalPage.xaml Add support for LightDismissing the renamer (#9733) 2021-04-07 00:12:41 +00:00
TerminalTab.cpp Maintain zoom when moving focus (#11046) 2021-09-02 14:36:17 +00:00
TerminalTab.h Maintain zoom when moving focus (#11046) 2021-09-02 14:36:17 +00:00
TerminalTab.idl Fix ATS tab status indicators (#9076) 2021-02-10 11:27:29 +00:00
TerminalTabStatus.cpp Fix ATS tab status indicators (#9076) 2021-02-10 11:27:29 +00:00
TerminalTabStatus.h Replace some of our macros to reduce confusion, increase success (#9376) 2021-03-04 11:27:03 -08:00
TerminalTabStatus.idl Fix ATS tab status indicators (#9076) 2021-02-10 11:27:29 +00:00
TitlebarControl.cpp Add support for setting a tab's color at runtime w/ context menu (#3789) 2020-05-04 20:57:12 +00:00
TitlebarControl.h Add support for setting a tab's color at runtime w/ context menu (#3789) 2020-05-04 20:57:12 +00:00
TitlebarControl.idl Upgrade to Microsoft.UI.Xaml 2.2 (#3027) 2019-10-14 22:41:43 -07:00
TitlebarControl.xaml Auto-format our XAML files and enforce in CI (#9589) 2021-03-29 17:09:38 -05:00
Toast.cpp Add an action for identifying windows (#9523) 2021-03-30 16:08:03 +00:00
Toast.h Add an action for identifying windows (#9523) 2021-03-30 16:08:03 +00:00