Open lassik opened 4 years ago
There were physical terminals that had selectable widths of 80 (punch card) or 132 (line printer). You could send yourself SIGWINCH, but I'm not sure what happens, if anything.
And HTML textareas, too.
AFAIK SIGWINCH is just a notification that means, "please do TIOCGWINSZ to find out the new size".
In HTML, a <textara>
is probablu not a natural way to emulate a terminal. You'd want to use a canvas or a table or something, and trap keyboard events globally. Major work was done on Gambit's JS backend this summer and BiwaScheme is coming along nicely so we could try it.
From https://invisible-island.net/xterm/ctlseqs/ctlseqs.html
CSI Ps ; Ps ; Ps t Window manipulation (XTWINOPS), dtterm, extended by xterm. These controls may be disabled using the allowWindowOps resource.
xterm uses Extended Window Manager Hints (EWMH) to maximize the window. Some window managers have incomplete support for EWMH. For instance, fvwm, flwm and quartz-wm advertise sup- port for maximizing windows horizontally or vertically, but in fact equate those to the maximize operation. Valid values for the first (and any additional parameters) are: Ps = 1 ⇒ De-iconify window. Ps = 2 ⇒ Iconify window. Ps = 3 ; x ; y ⇒ Move window to [x, y]. Ps = 4 ; height ; width ⇒ Resize the xterm window to given height and width in pixels. Omitted parameters reuse the current height or width. Zero parameters use the dis- play's height or width. Ps = 5 ⇒ Raise the xterm window to the front of the stack- ing order. Ps = 6 ⇒ Lower the xterm window to the bottom of the stacking order. Ps = 7 ⇒ Refresh the xterm window. Ps = 8 ; height ; width ⇒ Resize the text area to given height and width in characters. Omitted parameters reuse the current height or width. Zero parameters use the display's height or width. Ps = 9 ; 0 ⇒ Restore maximized window. Ps = 9 ; 1 ⇒ Maximize window (i.e., resize to screen size). Ps = 9 ; 2 ⇒ Maximize window vertically. Ps = 9 ; 3 ⇒ Maximize window horizontally. Ps = 1 0 ; 0 ⇒ Undo full-screen mode. Ps = 1 0 ; 1 ⇒ Change to full-screen. Ps = 1 0 ; 2 ⇒ Toggle full-screen. Ps = 1 1 ⇒ Report xterm window state. If the xterm window is non-iconified, it returns CSI 1 t . If the xterm window is iconified, it returns CSI 2 t . Ps = 1 3 ⇒ Report xterm window position. Note: X Toolkit positions can be negative, but the reported values are unsigned, in the range 0-65535. Negative values correspond to 32768-65535. Result is CSI 3 ; x ; y t Ps = 1 3 ; 2 ⇒ Report xterm text-area position. Result is CSI 3 ; x ; y t Ps = 1 4 ⇒ Report xterm text area size in pixels. Result is CSI 4 ; height ; width t Ps = 1 4 ; 2 ⇒ Report xterm window size in pixels. Normally xterm's window is larger than its text area, since it includes the frame (or decoration) applied by the window man- ager, as well as the area used by a scroll-bar. Result is CSI 4 ; height ; width t Ps = 1 5 ⇒ Report size of the screen in pixels. Result is CSI 5 ; height ; width t Ps = 1 6 ⇒ Report xterm character cell size in pixels. Result is CSI 6 ; height ; width t Ps = 1 8 ⇒ Report the size of the text area in characters. Result is CSI 8 ; height ; width t Ps = 1 9 ⇒ Report the size of the screen in characters. Result is CSI 9 ; height ; width t Ps = 2 0 ⇒ Report xterm window's icon label. Result is OSC L label ST Ps = 2 1 ⇒ Report xterm window's title. Result is OSC l label ST Ps = 2 2 ; 0 ⇒ Save xterm icon and window title on stack. Ps = 2 2 ; 1 ⇒ Save xterm icon title on stack. Ps = 2 2 ; 2 ⇒ Save xterm window title on stack. Ps = 2 3 ; 0 ⇒ Restore xterm icon and window title from stack. Ps = 2 3 ; 1 ⇒ Restore xterm icon title from stack. Ps = 2 3 ; 2 ⇒ Restore xterm window title from stack. Ps >= 2 4 ⇒ Resize to Ps lines (DECSLPP), VT340 and VT420. xterm adapts this by resizing its window.
There are a lot of goodies on that page. I didn't know XTerm does so much stuff.
From the current
Terminals.md
:Which backends support these operations? Windows Console probably does; does any Unix API?