Interprets the terminal events we care about:
- Resize events.
- Keyboard input.
Resize events are handled by registering a signal handler for SIGWINCH.
Keyboard events are read from stdin. We look for byte strings of key combinations that we care about. E.g. Alt-arrow keys, C-w etc.
Read stdin contents if it's ready for reading. Returns true when it was able to read. Buffer is not modified when return value is 0.