I recently posted a question about terminals and this seemed like it deserved its own question. If the tty which would be synonymous with terminal, is just the device driver/device file itself, what provides the actual interface to the terminal, and what is it called? I don't mean the gui in any way, I mean the actual area (either in a virtual terminal or a possibly a psuedo-terminal) where text is being printed and read. Is this considered a part of the terminal? Are these in some way controlled by the kernel? Basically if someone wanted to write a console program, like gnome-terminal (or even with virtual terminals), is there some sort of kernel based widget/interface that takes input and output? Basically is the tty (itself i.e. /dev/tty) just a file or does it include the code needed to display output (in various colors and weights), and read from the keyboard.
Is this correct: I found here What is the exact difference between a 'terminal', a 'shell', a 'tty' and a 'console'? that is says tty is synonymous with terminal. This is what is confusing me. I would think that to emulate a terminal or to provide a terminal, would require the terminal driver (tty) and the terminal display and interactive part (something like xterm). So by itself the tty is simply a driver for input and output, and what displays and reads the text from and to the tty is something like xterm? Would be calling the "/dev/tty a terminal driver" also be correct? Also when I say xterm I mean the value of the $TERM var.
Another thought (let me know about this one): The tty file is synonymous with the connection between the terminal or these day terminal emulator, and the shell. Now they are all in the same box, but the original terminals would be the terminal emulators of today (clearly), but the tty or tty files would sort of act like the serial connection between the terminal and the shell/operating system. These days it seems like to me the terminal emulator is an environment/window for interacting with the /dev/tty... files and the shell sits at the other side? So writing to the /dev/tty file would be like writing to or reading form the serial port? I'm assuming this is not exactly how it works, any help would be greatly appreciated :-(.