terminal
terminal copied to clipboard
COOKED_READ: cmd.exe tab fails to erase trailing characters
Windows build number
10.0.26052.0
Steps to reproduce
- Launch cmd.exe
- Type
foo bar - Move the cursor the space after
foo - Press tab
Expected Behavior
The prompt reads foo.
Actual Behavior
The prompt reads foo bar and trailing bar is inaccessible.
No way... This reproduces all the way back to conhost v1 lol. At this point we've found ReadConsole's dwCtrlWakeupMask API:
- overwrote the character under the cursor with the control character even though it wasn't ever intended to do that
- allowed you read beyond the end of the initialized buffer
- assumed that 1 char = 1 column despite being added after the W APIs got added
- ✨NEW✨ doesn't even erase the end of the prompt
At this point I finally got to say: Kudos to the people who designed, implemented and reviewed the CONSOLE_READCONSOLE_CONTROL API. Whoever you all are, all of you did a. fantastic. job.