Ctrl-C after pressing tab will sometimes not return to the directory prompt

I can list files and complete with tab. I can also cancel an operation with Ctrl-C. However, pressing Ctrl-C after pressing tab in a scenario when the system beeps, the operation is cancelled, but I am not returned to the command prompt.

What has actually happened is the displaying of the prompt is interrupted. If I press Enter I will see the prompt. I can also DIR in this state and see a directory listing.

This behavior is inconsistent and unsettling, because it feels like the computer has frozen or entered some kind of error state, because I was not shown the command prompt. It's inconsistent because normally if I type something and Ctrl-C, I still see a prompt. If I type something, tab, and then wait a moment after the beep, then press Ctrl-C, I WILL see a prompt. But if I tab and then press Ctrl-C too quickly, then there is no prompt. This is unsettling because when there is no prompt, it's usually because the computer is doing something and control hasn't yet been returned to be. But in this case, control has been returned, but without any indication. It's always very awkward, because I'm waiting for no reason.

I can confirm that it's not the beep itself that's the issue, as I can't reproduce it with the BEEP command. I also built a new command.com without any beeps, and the problem still occurs. It's probably an issue interacting with tab completion.

To reproduce:

Hold Ctrl, keep pressing tab until the system beeps, then quickly press C.

This is not an issue with the Kernel, as I can reproduce it when using FreeDOS command.com from MS-DOS. The issue is isolated to something in command.com, probably with the tab completion code, or nearby.

Edited by Matt D.