Vladimir wrote:
BigDumbDinosaur wrote:
I've worked with serial terminals ever since the first VT-series. Every terminal I've used is capable of scrolling in either direction, a feature widely used in full-screen editors. For example, the escape sequence in a Wyse 60 to move the cursor up the screen and scroll the display if the cursor is already on the top row is <ESC>J, referred to as a reverse linefeed. The screen can be scrolled in either direction without moving the cursor with the escape sequences <ESC>wE to go up and <ESC>wF to go down.
How does it work (step by step)?
In what direction are the codes transmitted? Reverse linefeed, for example...
You press the button 'cursor up' , "Wyse 60" sends to mainframe <ESC>J and mainframe program sends content of the top line...?
The terminal does the interpretation, not the software running on the "mainframe" (which could be a small Linux box with serial interface hardware).
Let's suppose I'm on a Wyse 60 terminal operating in native emulation that is connected to a Linux box, and am using vim to edit a file. I'm somewhere in the middle of the file and the cursor is on the topmost row of the screen. I press the cursor-up key on the terminal's keyboard. Doing so causes the terminal to transmit
<VT> (
$0B) to the editor. Working through the termcap file for the Wyse 60 (assuming the TERM environment variable is correct set), the editor recognizes
<VT> as a cursor-up keystroke, that is, a reverse linefeed.
The control sequence for a reverse linefeed is looked up in the Wyse 60 termcap file and vim transmits
<ESC>J to the terminal. Upon seeing that escape sequence, the Wyse 60 attempts to move the cursor up a row. However, the cursor is already on the top row, so the terminal internally shifts video RAM so everything is 80 bytes higher and then writes nulls into the first 80 bytes, causing a blank row to appear at the top of the screen. A corresponding shift is also made in attribute memory so display attributes such as reverse or flashing are moved along with the visible characters.
After vim has sent the reverse linefeed it will write the now visible previous line of text to the terminal, starting at column 0, row 0, causing the blank row that was opened up by the terminal to display the text being edited. So the scrolling of the screen is actually performed by the terminal. vim's work is limited to recognizing the cursor-up keystroke and sending a reverse linefeed escape sequence to the terminal, followed by writing to the top row once the terminal has scrolled the display.
Although terminals such as the DEC VT-series and Wyse 60 are referred to as "dumb," they actually have quite a bit of intelligence—especially so, in the case of the Wyse 60 and its descendants, requiring only simple escape sequences to perform complex display operations. The Wyse 60 also has block graphics, which can be used to draw rectangles, enlarged characters, etc. A derivative of the Wyse 60, the Wyse 325 (I have one of those in my old computer stuff inventory), has color as well. The even more advanced Wyse 370 can do bit-map style graphics.