The Linux virtual terminal (tty) is an emulation of VT102 - Virtual terminal subsystem source.
The real VT100 (nearly the same as VT102) has the following behavior (I suppose):
- In the LINE mode all typed characters are first transmitted to the computer and then, returned to the terminal. Nothing is displayed on the terminal screen before returning from the host.
- The escape sequences are no exception - they are parsed and executed only after returning from the host. That is, if I want to change the font color to red, I should type
ESC[0;31m, this sequence goes to the computer, echoed back, VT102 receive this, parse and apply. There is no other way to change the terminal font color (in the LINE mode). I am not sure if the VT102 had different font colors though, but that is an example.
Picture from manual:
Excerpt from manual:
The LINE/LOCAL feature allows the operator to easily place the terminal in either an ON-LINE or a LOCAL (off-line) condition. When the terminal is on-line (ON-LINE indicator is lit) all characters typed on the keyboard are sent directly to the computer and messages from the computer are displayed on the screen. In the LOCAL condition (LOCAL indicator is lit), the terminal is electrically disconnected from the computer; messages are not sent to or received from the computer; and characters typed on the keyboard are echoed on the screen directly.
Source: VT100 series video terminal technical manual, third Edition, July 1982.
Why does the Linux
tty behave in a different way?
I put the
bash into the sleep mode, so it doesn't interfere, then type Esc
[0;31m and get just plain text, the color haven't changed - so, escape sequence has no effect.
I were ask the similar question couple of years ago - Why i can't send escape sequences from keyboard, but can do it from another tty?, but now I got the knowledge about VT102 Linux subsystem and want to understand why it works this way - not identically to the real hardware terminal in this aspect.