@njvack @b0rk Yeah, it was a lot simpler 40+ years ago where each component was a separate, tangible box connected by wires. Made it easy to keep track of what was done where. A modern terminal emulator, on one side talks to the window system and sees keypress events and does advanced font rendering. On the other side, it talks to a pty which is an abstraction of that ancient RS-232 line and is mostly a serialized byte stream that the kernel then treats as input and output.
@njvack @b0rk If the tty is in cooked mode, those simple tasks - echoing, ^H, ^W, etc are done by the tty driver. In raw or cbreak (like raw, but still looks for things like ^C ^Z ^\ etc), then it is the consuming program (eg readline, vim, etc) that reads chars and then decides what to send back to the tty and then to the emulator to be displayed (usually lots of escape codes to handle positioning along with the one or two chars to actually display).