Occasionally a terminal gets into a state where the Enter key no longer properly terminates text input prompts. For example, when running
sudo I generally just type my password and push Enter. Sometimes, however, pushing Enter has no apparent effect and I have to enter an EOF character with Ctrl+D. This weird behavior then persists for the remainder of the terminal's life.
What causes this behavior?