Cover V04, I06
Article
Sidebar 1
Sidebar 2
Sidebar 3
Table 1
Table 9
Table 10
Table 11
Table 12
Table 2
Table 3
Table 4
Table 5
Table 6a
Table 6b
Table 7
Table 8

nov95.tar


Sidebar: Static vs. Dynamic Windows

The decision to register lines and columns as a terminal capability dates from the time when terminals (and thus applications) could support only static window sizes. Since many terminals now can switch between 80- and 132-column modes and many other "terminals" are actually a window on a graphical work station, the hardware no longer forces the window size to be fixed. A lot of older software depends on the automatic margin behavior in combination with a static column count from the terminfo description. Output from such applications can become seriously scrambled if the window size changes during the session. More recent software sometimes tries to be more dynamic, and looks at shell variables LINES and COLS or COLUMNS (many implementations of the ls command are a good example of this). Even these applications, however, still assume that the number of columns does not vary during the lifetime of the process invocation.

The X Window System generates a "window change event" when a user changes some window dimensions. The X server sends this notification to the xterm client via X protocol messages. xterm reacts by adapting kernel parameters at the ioctl/stty level for the pseudo-tty which connects it to the application. Addition of these lines/columns parameters at the terminal line discipline level inside the kernel happened fairly recently, and was the appropriate reaction to the appearance of a windowing environment. The application running inside the xterm window is supposed to ask for up-to-date numbers from its pty every time it generates new screen output. Alternatively, the application may choose to catch the Window Change signal which xterm generates at every change (default behavior for this signal is SIG_IGN, so older applications which don't even know about the existence of this mechanism don't notice it either). Modern versions of vi and pg are good examples of this dynamic adaptation.