Name

console-resize, resizecons — resize a user-space virtual terminal

Synopsis

console-resize [--lines] [--7bit] [--8bit] [--vt420] {size}

resizecons [--lines] [--7bit] [--8bit] [--vt420] {size}

Description

console-resize emits DEC VT control sequences to its standard output that instruct a DEC terminal (or a compatible terminal emulator such as console-terminal-emulator(1)) to change its screen dimensions.

size must be of the form COLSxROWS; unless the --lines command-line option is used, in which case it must be of the form ROWS.

console-resize does not employ operating system and device specific ioctl(2) calls. Rather, it emits simple terminal control sequences, as follows:

  1. To change the console width, it always emits the DECSCPP control sequence.

  2. If the --lines command-line option is not used, it also changes the console height. To do this, it emits the DECSLPP control sequence, unless the --vt420 command-line option is used, in which case it emits the DECNLS control sequence.

  3. It then resets the top, and bottom margins to the screen borders using the DECSTBM control sequence.

  4. If the --lines command-line option is not used, it then resets the left and right margins to the screen borders using the DECSLRM control sequence.

DECSTBM is supported by the DEC VT100 and later. DECSCPP and DECSLPP are supported by the DEC VT340 and later. DECSNLS and DECSLRM are supported by the DEC VT420 and later.

This command only works with DEC VT terminals or compatible terminal emulators. It simply assumes that its standard output is a terminal device that understands DEC VT420 control sequences, as it has no way to know. There is no termcap/terminfo capability covering this. Moreover, it makes no attempt to behave differently if its output is not to a terminal, since one might want to use it to generate the control sequences to send to a file, a pipe, or a non-terminal device.

If the --7bit command-line option is used, the CSI control character that begins all of the control sequences is sent using the ECMA-48 7-bit encoding scheme. If it is not used but the --8bit command-line option is used, the CSI control character is sent as a raw 8-bit character. By default, in the absence of either option, the CSI control character is sent encoded as UTF-8, in the expectation that the terminal is Unicode aware and decodes all output from UTF-8. This is not true of real DEC terminals, but is true of console-terminal-emulator(1).

DECSTBM and DECSLRM reset the cursor position to the origin. Note that some shells issue an ED control sequence as part of their prompt, which has the (perhaps unexpected) effect of clearing the screen if a shell prompt is issued immediately after the console has been resized.

COMPATIBILITY

For compatibility with the old "kbd" toolset, this command is also available as resizecons. Unlike the "kbd" toolset's resizecons command, this command is not specific to kernel virtual terminal character devices, does not involve reprogramming hardware, has no need of a restoretextmode(1) helper command, does not use stty(1), sends no signals, has no need of a setfont(1) helper command, and needs no dealings in fonts.

However, it does require a terminal that understands the DEC VT control sequences. The Linux and FreeBSD/TrueOS kernel virtual terminal subsystems do not.

DEC VT420 and VT520 terminals allow any value in a DECSLPP control sequence, and round the number up to the nearest value supported by the terminal display hardware. The xterm(1) terminal emulator recognizes several values not supported by DEC hardware and responds to them with quite different actions. Do not use ROWS values less than 24 if the output is being sent to xterm.

Author

Jonathan de Boyne Pollard