Documentation
¶
Overview ¶
Command terminal opens the Tango terminal component (ui/terminal) in a window, connected to a shell on a local pseudo-terminal (sys/pty).
go run ./examples/terminal # $SHELL (or the platform default) go run ./examples/terminal -shell "/bin/zsh -f" # any program with arguments go run ./examples/terminal -renderer cpu -font-size 15 -scheme dracula go run ./examples/terminal -echo # no PTY: input is echoed back go run ./examples/terminal -replay out.vt # no PTY: plays recorded output go run ./examples/terminal -remote # observes an in-memory daemon
Where there is no local pseudo-terminal (iOS, Android, js/wasm) the example falls back to the echo connection, so the same program shows the view, the soft keyboard and input methods on a phone. The echo and replay connections live in conns.go; they are small examples of implementing terminal.Conn.
On a phone the view is kept inside the safe area and above the soft keyboard.
The window title follows the title the program sets (OSC 0/2) and is "Tango Terminal" otherwise. The application quits when the program exits.
-auto presses 100 keys once the shell is up (x and Backspace in turn, so the line never wraps), one at a time, each as soon as the previous one has been echoed, and logs the key-to-echo latency (event posted until a frame shows the echo, including the PTY round trip) and the frame intervals; it needs a shell or -echo. Keys are posted right after a frame is built, so the latency is that of a key pressed just after a frame: the worst point of the display cycle. -bench-cat FILE runs "cat FILE" in the shell and logs the time until the output has been read and drawn (it waits for a line printed after cat); it needs a shell. -quit-after quits after the given duration (for scripted screenshots).