Commands: Screen Functions

Legend: Italic letters such as _n_ are ASCII numbers that serve as arguments, separated with a semicolon. If an argument is left out, it's treated as 0 or 1, depending on what makes sense for the command.

Erasing & Inserting

CodeMeaning
`\e[mJ` Clear part of screen. _m_: 0 - from cursor, 1 - to cursor, 2 - all
`\e[mK` Erase part of line. _m_: 0 - from cursor, 1 - to cursor, 2 - all
`\e[nX` Erase _n_ characters in line.
\e[nL \\ \e[nM Insert (`L`) or delete (`M`) _n_ lines. Following lines are pulled up or pushed down.
\e[n@ \\ \e[nP Insert (`@`) or delete (`P`) _n_ characters. The rest of the line is pulled left or pushed right. Characters going past the end of line are lost.

Supersized lines

CodeMeaning
`\e#1`, `\e#2` Make the current line part of a double-height line. Use `1` for the top, `2` for the bottom half.
`\e#3`, `\e#4` Make the current line part of a double-width, double-height line. Use `3` for the top, `4` for the bottom half.
`\e#6` Make the current line double-width.
`\e#5` Reset the current line to normal size.

Other

CodeMeaning
`\ec` Clear screen, reset attributes and cursor. This command also restores the default screen size, title, button labels and messages and the background URL.
\e[?1049h \\ \e[?1049l Switch to (`h`) or from (`l`) an alternate screen. ESPTerm can't implement this fully, so the original screen content is not saved, but it will remember the cursor, screen size, terminal title, button labels and messages.
`\e[8;r;ct` Set screen size to _r_ rows and _c_ columns (this is a command borrowed from Xterm)
`\e[nb` Repeat last printed characters _n_ times (moving cursor and using the current style).
`\e#8` Reset all screen attributes to default and fill the screen with the letter "E". This was historically used for aligning CRT displays, now can be useful e.g. for testing erasing commands.