terminal/src/renderer/vt
Mike Griese 7612044363
Implement a pair of shims for cls, Clear-Host in conpty mode (#5627)
## Summary of the Pull Request

This PR implements a pair of shims for `cmd` and `powershell`, so that their `cls` and `Clear-Host` functions will clear the entire terminal buffer (like they do in conhost), instead of just the viewport. With the conpty viewport and buffer being the same size, there's effectively no way to know if an application is calling these API's in this way with the intention of clearing the buffer or the viewport. We absolutely have to guess. 

Each of these shims checks to see if the way that the API is being called exactly matches the way `cmd` or `powershell` would call these APIs. If it does, we manually write a `^[[3J` to the connected terminal, to get he Terminal to clear it's own scrollback.

~~_⚠️ If another application were trying to clear the **viewport** with an exactly similar API call, this would also cause the terminal scrollback to get cleared ⚠️_~~

* [x] Should these shims be restricted to when the process that's calling them is actually `cmd.exe` or `powershell.exe`? Can I even do this? I think we've done such a good job of isolating the client process information from the rest of the host code that I can't figure out how to do this.
  - YES, this can be done, and I did it.
* [ ] **TODO**: _While I'm here_, should I have `DoSrvPrivateEraseAll` (the implementation for `^[[2J`, in `getset.cpp`) also manually trigger a EraseAll in the terminal in conpty mode?

## PR Checklist
* [x] Closes #3126
* [x] Actually closes #1305 too, which is really the same thing, but probably deserves a callout
* [x] I work here
* [x] Tests added/passed
* [n/a] Requires documentation to be updated

## Validation Steps Performed
* ran tests
* checked `cls` in the Terminal
* checked `Clear-Host` in the Terminal
* Checked running `powershell clear-host` from `cmd.exe`
2020-04-30 21:53:31 +00:00
..
lib Unify and clean up the common build properties (#3429) 2019-11-05 14:29:11 -08:00
ut_lib Merged PR 4465022: [Git2Git] Merged PR 4464559: Console: Ingest OSS changes up to e0550798 2020-03-26 01:20:36 +00:00
dirs Initial release of the Windows Terminal source code 2019-05-02 15:29:04 -07:00
invalidate.cpp Correct scrolling invalidation region for tmux in pty w/ bitmap (#5122) 2020-03-27 22:37:23 +00:00
math.cpp Correct scrolling invalidation region for tmux in pty w/ bitmap (#5122) 2020-03-27 22:37:23 +00:00
paint.cpp Don't remove spaces when printing a new bottom line with a background color (#5550) 2020-04-30 15:01:03 +00:00
precomp.cpp Initial release of the Windows Terminal source code 2019-05-02 15:29:04 -07:00
precomp.h add clang-format conf to the project, format the c++ code (#1141) 2019-06-11 13:27:09 -07:00
sources.inc inbox: reflect incoming changes from Windows 2019-05-14 16:16:43 -07:00
state.cpp Implement a pair of shims for cls, Clear-Host in conpty mode (#5627) 2020-04-30 21:53:31 +00:00
tracing.cpp Fix copying wrapped lines by implementing better scrolling (#5181) 2020-04-09 00:06:25 +00:00
tracing.hpp Fix copying wrapped lines by implementing better scrolling (#5181) 2020-04-09 00:06:25 +00:00
vt-renderer-common.vcxitems Unify and clean up the common build properties (#3429) 2019-11-05 14:29:11 -08:00
vtrenderer.hpp Implement a pair of shims for cls, Clear-Host in conpty mode (#5627) 2020-04-30 21:53:31 +00:00
VtSequences.cpp Implement a pair of shims for cls, Clear-Host in conpty mode (#5627) 2020-04-30 21:53:31 +00:00
WinTelnetEngine.cpp When Conpty encounters an unknown string, flush immediately (#4896) 2020-03-12 16:31:45 -07:00
WinTelnetEngine.hpp Make the terminal parser/adapter and related classes use modern… (#3956) 2019-12-19 14:12:53 -08:00
Xterm256Engine.cpp Implement a pair of shims for cls, Clear-Host in conpty mode (#5627) 2020-04-30 21:53:31 +00:00
Xterm256Engine.hpp Implement a pair of shims for cls, Clear-Host in conpty mode (#5627) 2020-04-30 21:53:31 +00:00
XtermEngine.cpp Don't remove spaces when printing a new bottom line with a background color (#5550) 2020-04-30 15:01:03 +00:00
XtermEngine.hpp Make Conpty emit wrapped lines as actually wrapped lines (#4415) 2020-02-27 16:40:11 +00:00