microsoft / terminal

The new Windows Terminal and the original Windows console host, all in the same place!
MIT License
95.63k stars 8.32k forks source link

Cannot create a binding to output Esc only #17712

Open yerlaser opened 2 months ago

yerlaser commented 2 months ago

Windows Terminal version

No response

Windows build number

No response

Other Software

No response

Steps to reproduce

Try to create a new binding to output Esc character (\x1B)

Expected Behavior

Pressing the binding should send Esc character to the app

Actual Behavior

Nothing gets sent, which in WSL can be confirmed by running cat program. Interestingly, it is possible to create a binding that sends Escape Sequences, e.g. Alt-q (\x1Bq), but not the Esc itself.

carlos-zamora commented 2 months ago

Thanks for filing. As a workaround, you can set your sendInput sequence to \u001b[27;1;27;1;0;1_\u001b[27;1;27;0;0;1_. This sends it as a win32 input sequence.

As for solutions on our end:

  1. there's a bug where we drop escape characters at the end of the input chunk. They shouldn't get lost.
  2. add a timeout such that the escape characters are flushed out to the application.