Implements keypress buffering

There is an underlying assumption in `readline.emitKeypressEvents` (and by extension `emitKey`) that the given stream (usually `process.stdin`) would emit `'data'` once per keypress, which is not always the case.

Fixes #7599.