DECSNLS Select Number of Lines per Screen
Choose how many lines the screen shows at once.
CSI Pn * |
- DEC STD 070
- §5.5 Select Number of Lines per Screen, p. 5-89
- VT510
- DECSNLS—Set Lines Per Screen
Choose how many lines, Pn from 1 to 255, the screen shows at once. On a DEC terminal this picks a font height: DEC STD 070 says it “selects the maximum number of lines which can be displayed on the screen by choosing a corresponding font size”, that a value it does not support picks the next larger one it does, and that a value past the largest picks the largest. The VT420, it says, offers 24, 39 or 49 lines. DEC STD 070 lists DECSNLS among its documented exceptions, part of the windowing extension.
xterm, a VT420 by default, implements it at level 4 (CASE_DECSNLS). It ignores Pn outside 1 to 255, and otherwise asks the window system to make the window Pn lines tall (RequestResize). Window operations like this one are allowed by default: xterm’s allowWindowOps is false (main.h), but an operation is still allowed unless it is named in disallowedWindowOps (AllowWindowOps), and the default list (main.h) does not name this one. Nothing on the screen changes until the window does, which is up to the window manager, so there is nothing a case here can check for a valid Pn.
The same request comes from xterm’s CSI Pn t with Pn of 24 or more, DECSLPP (window_ops; the VT510 manual’s DECSLPP sets lines per page). libghostty-vt passes some of xterm’s CSI Ps t window operations to its host, but not that one.
libghostty-vt has no handler for CSI Pn * |: its control sequence dispatch in stream.zig has no case for the final byte |. Since a valid DECSNLS changes nothing on the screen in xterm either, the cases agree.
Validation
DECSNLS-1: Nothing changes at once
AB
\e[2;3H
\e[2*| # two lines per screen
X
|AB____|
|__X___|
|______|
DECSNLS-2: Zero or 256 is ignored
\e[2;3H
\e[*| # left out, so zero
\e[256*|
X
|______|
|__X___|
|______|
cursor 2,4