microsoft / terminal

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

Send EOF when CTRL+D is pressed in CMD or PowerShell. (Alias for CTRL+Z) #14764

Open daviewales opened 1 year ago

daviewales commented 1 year ago

Description of the new feature/enhancement

Send EOF to Windows programs when CTRL+D is pressed. Essentially, make CTRL+D an alias for CTRL+Z, to mirror the shortcut from Linux.

This would make exiting from cross-platform REPLs such as Python more consistent across platforms. For example, on Linux I can exit a Python REPL with CTRL+D, but on Windows I have to use CTRL+Z, ENTER. There was an issue requesting this functionality in the Python REPL itself, but it was closed as they didn't want to go against the OS norms.

Proposed technical implementation details (optional)

When a user presses CTRL+D in CMD or PowerShell, it should send the same signal to the running program that is currently sent when CTRL+Z is pressed.

carlos-zamora commented 1 year ago

Unfortunately, CTRL+Z is baked into the console pretty deep. This seems possible but it's not something we'll be able to prioritize. In the meantime, you can replace CTRL+Z with CTRL+D in your terminal's config by adding a sendInput action: https://learn.microsoft.com/en-us/windows/terminal/customize-settings/actions#send-input