From 491ec14291357ae93af6376ff54df530d34f847b Mon Sep 17 00:00:00 2001 From: Mike Griese Date: Fri, 19 Jul 2019 15:13:46 -0500 Subject: [PATCH] Passthrough input too --- conpty.txt | 97 ++++++++++++ conpty001.txt | 273 +++++++++++++++++++++++++++++++++ passthough.txt | 9 ++ passthrough001.txt | 38 +++++ src/host/VtInputThread.cpp | 23 ++- src/host/VtIo.cpp | 4 + src/host/VtIo.hpp | 1 + src/host/_stream.cpp | 5 +- src/renderer/vt/state.cpp | 5 + src/renderer/vt/vtrenderer.hpp | 1 + src/tools/scratch/main.cpp | 77 +++++++++- tools/scratch.cmd | 2 +- 12 files changed, 529 insertions(+), 6 deletions(-) create mode 100644 conpty.txt create mode 100644 conpty001.txt create mode 100644 passthough.txt create mode 100644 passthrough001.txt diff --git a/conpty.txt b/conpty.txt new file mode 100644 index 000000000..e6a75c318 --- /dev/null +++ b/conpty.txt @@ -0,0 +1,97 @@ +Microsoft Windows [Version 10.0.18936.1001]]0;C:\WINDOWS\system32\cmd.exe[?25h +(c) 2019 Microsoft Corporation. All rights reserved. + +[11:54:25.95]>c:\Users\migrie\dev\private\OpenConsole>  +[1] [dev/migrie/f/passthrough-2019] migrie@MIGRIE-SURFBOOK>wsl.exe +]0;C:\WINDOWS\system32\cmd.exe - wsl.exezadjii@migrie-surfbook:/mnt/c/Users/migrie/dev/private/OpenConsole$ ]0;zadjii@migrie-surfbook: /mnt/c/Users/migrie/dev/private/OpenConsolevi README.md +[?2004h[?2004h + + + + + + + + + + + + + + + + + + + + + + + + + + + + +[?25h"README.md" 177L, 11259C[?25h[?2004l[?2004h[?25h[?2004l[?2004h▽[?25h[>c]10;?]11;? + [?25h README.md  ◀◀ buffers  + 1 # Welcome\!  + 2 #### This repository contains the source code for: + 3  + 4  * Windows Terminal + 5  * The Windows console host (conhost.exe) + 6  * Components shared between the two projects + 7  * ColorTool + 8  *  + 8  * Sample projects that show how to consume the Window + s Console APIs + 9   + 10 #### Other related repositories include: + 11  * Console API Documentation + 12  + 13 ### Build Status + 14  + 15 Project|Build Status + 16 ---|--- + 17 Terminal|Build Status + 17 Terminal|Build Status +  + 18 ColorTool| +  + 19  + 20 # Terminal & Console Overview + 21  + 22 Please take a few minutes to review the overview below before diving into the code: + 23  + 24 ## Windows Terminal[?2004l[?2004h[?2004l[?2004h[?2004l[?2004h[?2004l[?2004h[?2004l[?2004h[?2004l[?2004h[?2004h + NORMAL ▶ ⎇ dev/migrie/f/passthrough-2019 ▶ < markdown ◀ [unix] ◀ 1,397 words « 3% ␊ 6/177 ㏑ : 46 ◀ Ξ [9]trailing ◀]0;/mnt/c/Users/migrie/dev/private/OpenConsole/README.md+0 ~0 -0 ⎇ dev/migrie/f/passthrough-2019 ▶ <[?25h^[[?25h [?25h[?2004h:[?25hq +[?2004l]0;[?2004lMicrosoft Windows [Version 10.0.18936.1001] +(c) 2019 Microsoft Corporation. All rights reserved. + +[11:54:25.95]>c:\Users\migrie\dev\private\OpenConsole> +[1] [dev/migrie/f/passthrough-2019] migrie@MIGRIE-SURFBOOK>wsl.exe +zadjii@migrie-surfbook:/mnt/c/Users/migrie/dev/private/OpenConsole$ vi README.md  +zadjii@migrie-surfbook:/mnt/c/Users/migrie/dev/private/OpenConsole$  + + + + + + + + + + + + + + + + + + + + + + +]0;zadjii@migrie-surfbook: /mnt/c/Users/migrie/dev/private/OpenConsole[?25h diff --git a/conpty001.txt b/conpty001.txt new file mode 100644 index 000000000..eb91748ba --- /dev/null +++ b/conpty001.txt @@ -0,0 +1,273 @@ +Microsoft Windows [Version 10.0.18936.1001]]0;C:\WINDOWS\system32\cmd.exe[?25h +(c) 2019 Microsoft Corporation. All rights reserved. + +[12:00:25.93]>c:\Users\migrie\dev\private\OpenConsole>  +[1] [dev/migrie/f/passthrough-2019] migrie@MIGRIE-SURFBOOK>wsl.exe +]0;C:\WINDOWS\system32\cmd.exe - wsl.exezadjii@migrie-surfbook:/mnt/c/Users/migrie/dev/private/OpenConsole$ ]0;zadjii@migrie-surfbook: /mnt/c/Users/migrie/dev/private/OpenConsolevi README.md +[?2004h[?2004h + + + + + + + + + + + + + + + + + + + + + + + + + + + + +[?25h"README.md" 177L, 11259C[?25h[?2004l[?2004h[?25h[?2004l[?2004h▽[?25h [?25h[>c]10;?]11;? README.md  ◀◀ buffers  + 1 # Welcome\!  + 2 #### This repository contains the source code for: + 3  + 4  * Windows Terminal + 5  * The Windows console host (conhost.exe) + 6  * Components shared between the two projects + 7  * ColorTool + 8  *  8  * Sample projects that show how to consume the Window + s Console APIs + 9   + 10 #### Other related repositories include: + 11  * Console API Documentation + 12  + 13 ### Build Status + 14  + 15 Project|Build Status + 16 ---|--- + 17 Terminal|Build Status 17 Terminal|Build Status +  + 18 ColorTool| +  + 19  + 20 # Terminal & Console Overview + 21  + 22 Please take a few minutes to review the overview below before diving into the code: + 23  + 24 ## Windows Terminal[?2004l[?2004h[?2004l[?2004h[?2004l[?2004h[?2004l[?2004h[?2004l[?2004h[?2004l[?2004h[?2004l[?2004h[?2004l[?2004h[?2004l[?2004h[?2004h + NORMAL ▶ ⎇ dev/migrie/f/passthrough-2019 ▶ < markdown ◀ [unix] ◀ 1,397 words « 3% ␊ 6/177 ㏑ : 46 ◀ Ξ [9]trailing ◀]0;/mnt/c/Users/migrie/dev/private/OpenConsole/README.md+0 ~0 -0 ⎇ dev/migrie/f/passthrough-2019 ▶ <[?25h~@k[?25h[ColorTool](https://github.com/Microsoft/Terminal/tree/master/src/tools/ColorTool)Sample projects that show how to consume the Windownsole APIs + Other related repositories include:Console API Documentation +Build Status +ect|Build Status---inal|Build Status +rTool| + +rminal & Console Overview +se take a few minutes to review the overview below before diving into the code: +indows Terminal▶ +0 ~0 -0 ⎇ dev/migrie/f/passthrough-2019 ▶ < ◀ [unix] ◀ 1,397 words « 3% ␊ 7/177 ㏑ : 46 ◀ Ξ [9]trmd" 177L, 11259C[?25h~@k[?25h 7  * ColorTool + 8  * [Sample projects](https://github.com/Microsoft/Terminal/tree/master/samples) that show how to consume the Window + s Console APIs + 9   + 10 #### Other related repositories include: + 11  * Console API Documentation + 12  + 13 ### Build Status + 14  + 15 Project|Build Status + 16 ---|--- + 17 Terminal|Build Status +  + 18 ColorTool| +  + 19  + 20 # Terminal & Console Overview + 21  + 22 Please take a few minutes to review the overview below before diving into the code: + 23  + 24 ## Windows Terminal + NORMAL ▶ +0 ~0 -0 ⎇ dev/migrie/f/passthrough-2019 ▶ < ◀ [unix] ◀ 1,397 words « 4% ␊ 8/177 ㏑ : 46 ◀ Ξ [9]trailing ◀ +"README.md" 177L, 11259C[?25h~@k[?25h 8  * Sample projects that show how to consume the Window + s Console APIs + 9   + 10 #### Other related repositories include: + 11  * Console API Documentation + 12  + 13 ### Build Status + 14  + 15 Project|Build Status + 16 ---|--- + 17 Terminal|Build Status +  + 18 ColorTool| +  + 19  + 20 # Terminal & Console Overview + 21  + 22 Please take a few minutes to review the overview below before diving into the code: + 23  + 24 ## Windows Terminal + NORMAL ▶ +0 ~0 -0 ⎇ dev/migrie/f/passthrough-2019 ▶ < ◀ [unix] ◀ 1,397 words « 5% ␊ 9/177 ㏑ : 2 ◀ Ξ [9]trailing ◀ +"README.md" 177L, 11259C[?25h~@k[?25h10/177 ㏑ : 40 ◀ Ξ [9]tr[?25h~@k[?25h[Console API Documentation](https://github.com/MicrosoftDocs/Console-Docs) +Build Status +ect|Build Status---inal|Build Status +rTool| + +rminal & Console Overview +se take a few minutes to review the overview below before diving into the code: +indows Terminal▶ +0 ~0 -0 ⎇ dev/migrie/f/passthrough-2019 ▶ < ◀ [unix] ◀ 1,397 words « 6% ␊ 11/177 ㏑ : 46 ◀ Ξ [9]trmd" 177L, 11259C[?25h~@k[?25hConsole API Documentation +Build Status +ect|Build Status---inal|Build Status +rTool| + +rminal & Console Overview +se take a few minutes to review the overview below before diving into the code: +indows Terminal▶ +0 ~0 -0 ⎇ dev/migrie/f/passthrough-2019 ▶ < ◀ [unix] ◀ 1,397 words « 6% ␊ 12/177 ㏑ : 1 ◀ Ξ [9]trmd" 177L, 11259C[?25h~@k[?25h7% ␊ 13/177 ㏑ : 16 ◀ Ξ [9]tr[?25h~@k[?25h4/177 ㏑ : 1 ◀ Ξ [9]tr[?25h~@k[?25h8% ␊ 15/177 ㏑ : 20 ◀ Ξ [9]tr[?25h~@k[?25h9% ␊ 16/177 ㏑ : 7 ◀ Ξ [9]tr[?25h~@k[?25h 17 Terminal|[![Build Status](https://dev.azure.com/ms/Terminal/_apis/build/status/Terminal%20CI?branchName=master)](htt + ps://dev.azure.com/ms/Terminal/_build?definitionId=136) + 18 ColorTool| +  + 19  + 20 # Terminal & Console Overview + 21  + 22 Please take a few minutes to review the overview below before diving into the code: + 23  + 24 ## Windows Terminal + NORMAL ▶ +0 ~0 -0 ⎇ dev/migrie/f/passthrough-2019 ▶ < ◀ [unix] ◀ 1,397 words « 9% ␊ 17/177 ㏑ : 46 ◀ Ξ [9]trailing ◀ +"README.md" 177L, 11259C[?25h~@k[?25h 17 Terminal|Build Status +  + 18 ColorTool|![](https://microsoft.visualstudio.com/_apis/public/build/definitions/c93e867a-8815-43c1-92c4-e7dd5404f1e1 + /17023/badge) + 19  + 20 # Terminal & Console Overview + 21  + 22 Please take a few minutes to review the overview below before diving into the code: + 23  + 24 ## Windows Terminal + NORMAL ▶ +0 ~0 -0 ⎇ dev/migrie/f/passthrough-2019 ▶ < ◀ [unix] ◀ 1,397 words « 10% ␊ 18/177 ㏑ : 46 ◀ Ξ [9]trailing ◀ +"README.md" 177L, 11259C[?25h~@k[?25h 18 ColorTool| +  + 19  + 20 # Terminal & Console Overview + 21  + 22 Please take a few minutes to review the overview below before diving into the code: + 23  + 24 ## Windows Terminal + NORMAL ▶ +0 ~0 -0 ⎇ dev/migrie/f/passthrough-2019 ▶ < ◀ [unix] ◀ 1,397 words « 10% ␊ 19/177 ㏑ : 1 ◀ Ξ [9]trailing ◀ +"README.md" 177L, 11259C[?25h~@k[?25h1% ␊ 20/177 ㏑ : 29 ◀ Ξ [9]tr[?25h~@k[?25h1/177 ㏑ : 1 ◀ Ξ [9]tr[?25h~@k[?25h 2 #### This repository contains the source code for: + 3  + 4  * Windows Terminal + 5  * The Windows console host (conhost.exe) + 6  * Components shared between the two projects + 7  * ColorTool + 8  * Sample projects that show how to consume the Window + s Console APIs + 9   + 10 #### Other related repositories include: + 11  * Console API Documentation + 12  + 13 ### Build Status + 14  + 15 Project|Build Status + 16 ---|--- + 17 Terminal|Build Status +  + 18 ColorTool| +  + 19  + 20 # Terminal & Console Overview + 21  + 22 Please take a few minutes to review the overview below before diving into the code: + 23  + 24 ## Windows Terminal + 25  + NORMAL ▶ +0 ~0 -0 ⎇ dev/migrie/f/passthrough-2019 ▶ < ◀ [unix] ◀ 1,397 words « 12% ␊ 22/177 ㏑ : 46 ◀ Ξ [9]trailing ◀ +[?25h~@k[?25h 5  * The Windows console host (conhost.exe) + 6  * Components shared between the two projects + 7  * ColorTool + 8  * Sample projects that show how to consume the Window + s Console APIs + 9   + 10 #### Other related repositories include: + 11  * Console API Documentation + 12  + 13 ### Build Status + 14  + 15 Project|Build Status + 16 ---|--- + 17 Terminal|Build Status +  + 18 ColorTool| +  + 19  + 20 # Terminal & Console Overview + 21  + 22 Please take a few minutes to review the overview below before diving into the code: + 23  + 24 ## Windows Terminal + 25  + 26 Windows Terminal is a new, modern, feature-rich, productive terminal application for command-line users. It includes +  many of the features most frequently requested by the Windows command-line community including support for tabs, ri + ch text, globalization, configurability, theming & styling, and more. + NORMAL ▶ +0 ~0 -0 ⎇ dev/migrie/f/passthrough-2019 ▶ < ◀ [unix] ◀ 1,397 words « 12% ␊ 23/177 ㏑ : 1 ◀ Ξ [9]trailing ◀ +[?25h~@k[?25h3% ␊ 24/177 ㏑ : 19 ◀ Ξ [9]tr[?25h◀ [unix] ◀ 1,397 words « 13% ␊ 24/177 ㏑ : 19 ◀ Ξ [64[?25h~@k[?25h 1 # Welcome\!  + 2 #### This repository contains the source code for: + 3  + 4  * Windows Terminal + 5  * The Windows console host (conhost.exe) + 6  * Components shared between the two projects + 7  * ColorTool + 8  * Sample projects that show how to consume the Window + s Console APIs + 9   + 10 #### Other related repositories include: + 11  * Console API Documentation + 12  + 13 ### Build Status + 14  + 15 Project|Build Status + 16 ---|--- + 17 Terminal|Build Status +  + 18 ColorTool| +  + 19  + 20 # Terminal & Console Overview + 21  + 22 Please take a few minutes to review the overview below before diving into the code: + 23  + 24 ## Windows Terminal + NORMAL ▶ +0 ~0 -0 ⎇ dev/migrie/f/passthrough-2019 ▶ <◀ [unix] ◀ 1,397 words « 3% ␊ 6/177 ㏑ : 3 ◀ Ξ [64]trailing ◀ +[?25h^[[?25h [?25h[?2004h:[?25hq [?2004l]0;[?2004lMicrosoft Windows [Version 10.0.18936.1001] +(c) 2019 Microsoft Corporation. All rights reserved. + +[12:00:25.93]>c:\Users\migrie\dev\private\OpenConsole> +[1] [dev/migrie/f/passthrough-2019] migrie@MIGRIE-SURFBOOK>wsl.exe +zadjii@migrie-surfbook:/mnt/c/Users/migrie/dev/private/OpenConsole$ vi README.md  +zadjii@migrie-surfbook:/mnt/c/Users/migrie/dev/private/OpenConsole$  + + + + + + + + + + + + + + + + + + + + + + +]0;zadjii@migrie-surfbook: /mnt/c/Users/migrie/dev/private/OpenConsole[?25h \ No newline at end of file diff --git a/passthough.txt b/passthough.txt new file mode 100644 index 000000000..d5d98bfdb --- /dev/null +++ b/passthough.txt @@ -0,0 +1,9 @@ +Microsoft Windows [Version 10.0.18936.1001]]0;C:\WINDOWS\system32\cmd.exe[?25h +(c) 2019 Microsoft Corporation. All rights reserved. + +[11:53:17.73]>c:\Users\migrie\dev\private\OpenConsole>  +[1] [dev/migrie/f/passthrough-2019] migrie@MIGRIE-SURFBOOK>scratch -- wsl.exe +]0;zadjii@migrie-surfbook: /mnt/c/Users/migrie/dev/private/OpenConsolezadjii@migrie-surfbook:/mnt/c/Users/migrie/dev/private/OpenConsole$ vi README.md +[?1000h[?2004h[?2004h[?1049h[?1h=[?2004h[?2004h[?12h[?12l[?25l"README.md" 177L, 11259C[?1000l[?2004l[?2004l[?1000h[?2004h[?2004h[?25h[?1000l[?2004l[?2004l[?1000h[?2004h[?2004h▽ [>c[>c]10;?]11;?]10;?]11;? README.md   ◀◀ buffers [?25l 1 # Welcome\!   2 #### This repository contains the source code for:  3   4  * Windows Terminal  5  * The Windows console host (conhost.exe)  6  * Components shared between the two projects  7  * ColorTool  8  * Sample projects that show how to consume the Window  s Console APIs  9    10 #### Other related repositories include:  11  * Console API Documentation  12   13 ### Build Status  14   15 Project|Build Status  16 ---|---  17 Terminal|Build Status    18 ColorTool|    19   20 # Terminal & Console Overview  21   22 Please take a few minutes to review the overview below before diving into the code:  23   24 ## Windows Terminal [?25h[?1000l[?2004l[?2004l[?1000h[?2004h[?2004h[?1000l[?2004l[?2004l[?1000h[?2004h[?2004h[?1000l[?2004l[?2004l[?1000h[?2004h[?2004h[?1000l[?2004l[?2004l[?1000h[?2004h[?2004h[?1000l[?2004l[?2004l[?1000h[?2004h[?2004h[?1000l[?2004l[?2004l[?1000h[?2004h[?2004h[?1000l[?2004l[?2004l[?1000h[?2004h[?2004h[?2004h[?2004h NORMAL ▶ ⎇ dev/migrie/f/passthrough-2019 ▶ < markdown ◀ [unix] ◀ 1,397 words « 3% ␊ 6/177 ㏑ : 46 ◀ Ξ [9]trailing ◀]2;/mnt/c/Users/migrie/dev/private/OpenConsole/README.md+0 ~0 -0 ⎇ dev/migrie/f/passthrough-2019 ▶ <[?25l[?25h[?25l^[[?25h[?25l [?25h[?25l:  +:[?2004h[?2004h[?25hq[?25l[?25h +[?25l[?1000l[?2004l[?2004l]2;[?2004l[?1l>[?2004l[?25h[?1049l]0;zadjii@migrie-surfbook: /mnt/c/Users/migrie/dev/private/OpenConsolezadjii@migrie-surfbook:/mnt/c/Users/migrie/dev/private/OpenConsole$ diff --git a/passthrough001.txt b/passthrough001.txt new file mode 100644 index 000000000..1f6f51920 --- /dev/null +++ b/passthrough001.txt @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +]0;C:\WINDOWS\system32\cmd.exe[?25hMicrosoft Windows [Version 10.0.18936.1001] +(c) 2019 Microsoft Corporation. All rights reserved. + +[12:28:24.24]>c:\Users\migrie\dev\private\OpenConsole>  +[1] [dev/migrie/f/passthrough-2019] migrie@MIGRIE-SURFBOOK>scratch -- wsl.exe +]0;C:\WINDOWS\system32\cmd.exe - scratch -- wsl.exeLaunching C:\Users\migrie\AppData\Local\Temp\OpenConsole\10525\scratch.exe... +C:\Users\migrie\AppData\Local\Temp\OpenConsole\10525\scratch.exe -- wsl.exe ]0;zadjii@migrie-surfbook: /mnt/c/Users/migrie/dev/private/OpenConsolezadjii@migrie-surfbook:/mnt/c/Users/migrie/dev/private/OpenConsole$ vi README.md +[?1000h[?2004h[?2004h[?1049h[?1h=[?2004h[?2004h[?12h[?12l[?25l"README.md" 177L, 11259C[?1000l[?2004l[?2004l[?1000h[?2004h[?2004h[?25h[?1000l[?2004l[?2004l[?1000h[?2004h[?2004h▽ [>c[>c]10;?]11;?]10;?]11;? README.md   ◀◀ buffers [?25l 1 # Welcome\!   2 #### This repository contains the source code for:  3   4  * Windows Terminal  5  * The Windows console host (`conhost.exe`)  6  * Components shared between the two projects  7  * ColorTool  8  * Sample projects that show how to consume the Window  s Console APIs  9    10 #### Other related repositories include:  11  * Console API Documentation  12   13 ### Build Status  14   15 Project|Build Status  16 ---|---  17 Terminal|Build Status    18 ColorTool|    19   20 # Terminal & Console Overview  21   22 Please take a few minutes to review the overview below before diving into the code:  23   24 ## Windows Terminal [?25h[?1000l[?2004l[?2004l[?1000h[?2004h[?2004h[?1000l[?2004l[?2004l[?1000h[?2004h[?2004h[?1000l[?2004l[?2004l[?1000h[?2004h[?2004h[?1000l[?2004l[?2004l[?1000h[?2004h[?2004h[?1000l[?2004l[?2004l[?1000h[?2004h[?2004h[?1000l[?2004l[?2004l[?1000h[?2004h[?2004h[?2004h[?2004h NORMAL ▶ ⎇ dev/migrie/f/passthrough-2019 ▶ < markdown ◀ [unix] ◀ 1,397 words « 2% ␊ 5/177 ㏑ : 10 ◀ Ξ [9]trailing ◀]2;/mnt/c/Users/migrie/dev/private/OpenConsole/README.md+0 ~0 -0 ⎇ dev/migrie/f/passthrough-2019 ▶ <[?25l[?25h[?25l~@k 36/conhost.exe) [?25h[?25l~@k 7/[ColorTool](https://github.com/Microsoft/Terminal/tree/master/src/tools/ColorTool)[?25h[?25l~@k 48/ColorTool [Sample projects](https://github.com/Microsoft/Terminal/tree/master/samples) that show how to consume the Windoww [?25h[?25l~@k 59/ 2Sample projects that show how to consume the Window  [?25h[?25l~@k 10/10[?25h[?25l~@k 61/[Console API Documentation](https://github.com/MicrosoftDocs/Console-Docs)[?25h[?25l~@k 2/ 1Console API Documentation [?25h[?25l~@k 73/10[?25h[?25l~@k 4/ 1[?25h[?25l~@k 85/10[?25h[?25l~@k 96/ 7[?25h[?25l~@k [![Build Status](https://dev.azure.com/ms/Terminal/_apis/build/status/Terminal%20CI?branchName=master)](httt ps://dev.azure.com/ms/Terminal/_build?definitionId=136)7/10[?25h[?25l~@k Build Status   ![](https://microsoft.visualstudio.com/_apis/public/build/definitions/c93e867a-8815-43c1-92c4-e7dd5404f1e11 /17023/badge)108/[?25h[?25l~@k 9/ 1   [?25h[?25l~@k 120/10[?25h[?25l~@k 1/ 1[?25h[?25l~@k  + 25   22/10[?25h[?25l~@k  26 Windows Terminal is a new, modern, feature-rich, productive terminal application for command-line users. It includess  many of the features most frequently requested by the Windows command-line community including support for tabs, rii ch text, globalization, configurability, theming & styling, and more. 3/ 1[?25h[?25l~@k 34/10[?25h[?25l~@k  1 # Welcome\!   2 #### This repository contains the source code for:  3   4  * Windows Terminal   6/ 3[?25h[?25l^[[?25h[?25l [?25h[?25l: :[?2004h[?2004h[?25hq[?25l[?25h [?25l[?1000l[?2004l[?2004l]2;[?2004l[?1l>[?2004l[?25h[?1049l]0;zadjii@migrie-surfbook: /mnt/c/Users/migrie/dev/private/OpenConsolezadjii@migrie-surfbook:/mnt/c/Users/migrie/dev/private/OpenConsole$ \ No newline at end of file diff --git a/src/host/VtInputThread.cpp b/src/host/VtInputThread.cpp index e7e968204..6e584a232 100644 --- a/src/host/VtInputThread.cpp +++ b/src/host/VtInputThread.cpp @@ -77,7 +77,28 @@ VtInputThread::VtInputThread(_In_ wil::unique_hfile hPipe, { return S_FALSE; } - _pInputStateMachine->ProcessString(pwsSequence.get(), cchSequence); + + CONSOLE_INFORMATION& gci = ServiceLocator::LocateGlobals().getConsoleInformation(); + if (gci.GetVtIo()->IsInPassthroughMode()) + { + try + { + std::deque> inputEvents; + for (size_t i = 0; i < cchSequence; i++) + { + inputEvents.push_back(std::make_unique(true, 1ui16, 0ui16, 0ui16, pwsSequence[i], 0)); + } + gci.GetActiveInputBuffer()->Write(inputEvents); + } + catch (...) + { + LOG_HR(wil::ResultFromCaughtException()); + } + } + else + { + _pInputStateMachine->ProcessString(pwsSequence.get(), cchSequence); + } } CATCH_RETURN(); diff --git a/src/host/VtIo.cpp b/src/host/VtIo.cpp index 22ff3ad2f..b6151faab 100644 --- a/src/host/VtIo.cpp +++ b/src/host/VtIo.cpp @@ -402,6 +402,10 @@ void VtIo::SetPassthroughMode(const bool enable) { _pVtRenderEngine->SetPassthroughMode(enable); } +bool VtIo::IsInPassthroughMode() +{ + return _pVtRenderEngine->IsInPassthroughMode(); +} void VtIo::PassthroughString(std::wstring_view view) { std::wstring wstr{ view }; diff --git a/src/host/VtIo.hpp b/src/host/VtIo.hpp index f0cbe1836..fe0c33668 100644 --- a/src/host/VtIo.hpp +++ b/src/host/VtIo.hpp @@ -38,6 +38,7 @@ namespace Microsoft::Console::VirtualTerminal void SetPassthroughMode(const bool enable); void PassthroughString(std::wstring_view view); + bool IsInPassthroughMode(); private: // After CreateIoHandlers is called, these will be invalid. diff --git a/src/host/_stream.cpp b/src/host/_stream.cpp index eb2062c77..07c28a1e7 100644 --- a/src/host/_stream.cpp +++ b/src/host/_stream.cpp @@ -941,11 +941,12 @@ using Microsoft::Console::VirtualTerminal::StateMachine; const DWORD dwFlags, _Inout_opt_ PSHORT const psScrollY) { - if (WI_IsFlagSet(screenInfo.OutputMode, ENABLE_PASSTHROUGH_MODE)) + CONSOLE_INFORMATION& gci = ServiceLocator::LocateGlobals().getConsoleInformation(); + if (gci.IsInVtIoMode() && gci.GetVtIo()->IsInPassthroughMode()) + // if (WI_IsFlagSet(screenInfo.OutputMode, ENABLE_PASSTHROUGH_MODE)) { const size_t BufferSize = *pcb; const size_t cch = BufferSize / sizeof(WCHAR); - CONSOLE_INFORMATION& gci = ServiceLocator::LocateGlobals().getConsoleInformation(); gci.GetVtIo()->PassthroughString({ pwchRealUnicode, cch }); // *pcb += BufferSize; // return STATUS_SUCCESS; diff --git a/src/renderer/vt/state.cpp b/src/renderer/vt/state.cpp index 03f8b89bc..9c352a947 100644 --- a/src/renderer/vt/state.cpp +++ b/src/renderer/vt/state.cpp @@ -428,3 +428,8 @@ void VtEngine::PassthroughString(const std::wstring& wstr) LOG_IF_FAILED(WriteTerminalW(wstr)); LOG_IF_FAILED(_Flush()); } + +bool VtEngine::IsInPassthroughMode() +{ + return _passthroughMode; +} diff --git a/src/renderer/vt/vtrenderer.hpp b/src/renderer/vt/vtrenderer.hpp index 415e4d7f2..762b82bec 100644 --- a/src/renderer/vt/vtrenderer.hpp +++ b/src/renderer/vt/vtrenderer.hpp @@ -97,6 +97,7 @@ namespace Microsoft::Console::Render void SetPassthroughMode(const bool enable); void PassthroughString(const std::wstring& wstr); + bool IsInPassthroughMode(); protected: wil::unique_hfile _hFile; diff --git a/src/tools/scratch/main.cpp b/src/tools/scratch/main.cpp index 85085f31f..887094a36 100644 --- a/src/tools/scratch/main.cpp +++ b/src/tools/scratch/main.cpp @@ -34,8 +34,7 @@ std::string osc(std::string seq) return fullSeq; } -// This wmain exists for help in writing scratch programs while debugging. -int __cdecl wmain(int /*argc*/, WCHAR* /*argv[]*/) +void testOutput() { wprintf(L"Attempting to start passthrough mode...\n"); auto hOut = GetStdHandle(STD_OUTPUT_HANDLE); @@ -101,6 +100,80 @@ int __cdecl wmain(int /*argc*/, WCHAR* /*argv[]*/) printf(csi("r").c_str()); wprintf(L"Press a key to continue\n"); _getch(); +} +void launchChild(int argc, WCHAR* argv[]) +{ + auto hOut = GetStdHandle(STD_OUTPUT_HANDLE); + auto hIn = GetStdHandle(STD_INPUT_HANDLE); + + DWORD dwMode = 0; + THROW_LAST_ERROR_IF(!GetConsoleMode(hOut, &dwMode)); + dwMode |= ENABLE_VIRTUAL_TERMINAL_PROCESSING; + dwMode |= DISABLE_NEWLINE_AUTO_RETURN; + dwMode |= ENABLE_PASSTHROUGH_MODE; + THROW_LAST_ERROR_IF(!SetConsoleMode(hOut, dwMode)); + + DWORD dwInMode = 0; + GetConsoleMode(hIn, &dwInMode); + dwInMode = ENABLE_VIRTUAL_TERMINAL_INPUT; + SetConsoleMode(hIn, dwInMode); + + std::wstring commandline = L""; + for (int i = 0; i < argc; i++) + { + commandline += (argv[i]); + commandline += (L" "); + } + + std::unique_ptr mutableCommandline = std::make_unique(commandline.length() + 1); + THROW_IF_NULL_ALLOC(mutableCommandline); + + HRESULT hr = StringCchCopy(mutableCommandline.get(), commandline.length() + 1, commandline.c_str()); + THROW_IF_FAILED(hr); + + STARTUPINFO si = { 0 }; + si.cb = sizeof(STARTUPINFOW); + PROCESS_INFORMATION _piClient; + + bool fSuccess = !!CreateProcessW( + nullptr, + mutableCommandline.get(), + nullptr, // lpProcessAttributes + nullptr, // lpThreadAttributes + true, // bInheritHandles + false, // dwCreationFlags + nullptr, // lpEnvironment + nullptr, // lpCurrentDirectory + &si, // lpStartupInfo + &_piClient // lpProcessInformation + ); + THROW_LAST_ERROR_IF(!fSuccess); + + // Sleep(10000); + WaitForSingleObject(_piClient.hProcess, INFINITE); +} + +// This wmain exists for help in writing scratch programs while debugging. +int __cdecl wmain(int argc, WCHAR* argv[]) +{ + for (int i = 0; i < argc; i++) + { + wprintf(argv[i]); + wprintf(L" "); + } + + if (argc > 1) + { + std::wstring arg1 = argv[1]; + if (arg1 == L"--test") + { + testOutput(); + } + else if (arg1 == L"--") + { + launchChild(argc - 2, &argv[2]); + } + } return 0; } diff --git a/tools/scratch.cmd b/tools/scratch.cmd index 05db5f2e9..44ebf4c34 100644 --- a/tools/scratch.cmd +++ b/tools/scratch.cmd @@ -21,4 +21,4 @@ rem Generate a unique name, so that we can debug multiple revisions of the binar (xcopy /Y %_last_build%\scratch.exe %TEMP%\%copy_dir%\scratch.exe*) > nul echo Launching %TEMP%\%copy_dir%\scratch.exe... -%TEMP%\%copy_dir%\scratch.exe +%TEMP%\%copy_dir%\scratch.exe %*