From 35eda31ff9ba3ddbb7b230fe3e32ed1faa2a6d49 Mon Sep 17 00:00:00 2001 From: froslanz Date: Thu, 12 Nov 2026 21:03:55 +0000 Subject: [PATCH] Update README.md --- README.md | 94 +------------------------------------------------------ 1 file changed, 1 insertion(+), 93 deletions(-) diff --git a/README.md b/README.md index 17e280a..83a199d 100644 --- a/README.md +++ b/README.md @@ -1,95 +1,3 @@ # gassyterm +Terminal emulator written on C++. -A small ANSI terminal emulator in C++17 that runs your shell in a real X11 -window. It forks the shell onto a pseudo-terminal, parses the escape sequences -the shell and its programs emit, and paints the result with Xft. - -## Build - -Requires a C++17 compiler, CMake ≥ 3.16, and the X11 + Xft development -packages (`libx11-dev`, `libxft-dev`, `libfontconfig1-dev` on Debian/Ubuntu). - -```sh -cmake -S . -B build -cmake --build build -j -``` - -## Run - -```sh -./build/gassyterm [shell] -``` - -The shell defaults to `/bin/sh`; pass another one as the first argument. Close -the window or leave the shell (`exit`, `^D`) to quit. The window resizes in whole character -cells and tells the shell about it via `SIGWINCH`. - -## Configuration - -Settings are read once at startup from `$XDG_CONFIG_HOME/gassyterm/config`, or -`~/.config/gassyterm/config` when `XDG_CONFIG_HOME` is unset. The file is -created with the defaults on first run, and changes apply the next time you -open the window (no rebuild needed). - -```ini -# ~/.config/gassyterm/config -font = monospace:size=11 -foreground = #cccccc -background = #0b0b0b -cursor = #cccccc -shell = /bin/sh -columns = 80 -rows = 24 -color4 = #2472c8 # optional: override any of color0..color15 -``` - -- `font` is a fontconfig pattern, so size, family and style go in one string - (`"Iosevka:size=13:weight=medium"`). If it cannot be matched, a generic - monospace font is used instead. -- Colours are `#rrggbb`. `cursor` falls back to `foreground`. -- `shell` is only used when no shell is given on the command line. -- `columns` and `rows` set the initial window size in cells. -- Unknown keys and malformed values are reported on stderr and ignored, so a - typo never stops the terminal from starting. - -## How it works - -- `src/pty.cpp` opens a pty pair (`posix_openpt`), forks, attaches the slave as - the child's controlling terminal and `exec`s the shell; also handles - `TIOCSWINSZ`. -- `src/ansi.cpp` is a byte-level escape sequence state machine (ground, escape, - CSI, OSC, DCS). It turns pty output into print/execute/CSI/ESC events without - touching the screen. -- `src/terminal.cpp` consumes those events: cursor movement, erasing, inserting - and deleting characters and lines, scrolling, SGR attributes, saved/restored - cursor, and UTF-8 decoding into cells. -- `src/screen.h` is the cell grid; each cell keeps up to four bytes of UTF-8, - foreground/background palette indices and attribute bits. -- `src/config.cpp` reads the startup settings from the XDG config directory - and creates a commented default file when there is none. -- `src/x11.cpp` is the window: display and window setup, fontconfig/Xft font - loading, the 256-colour palette, key mapping (modelled on `st`), and - cell-by-cell rendering into a pixmap that is blitted on expose. -- `src/main.cpp` runs a `select` loop over the X connection and the pty, feeds - pty output to the terminal and repaints when the screen is dirty. - -## Keys - -Return, Backspace (`^H` and `^?`), Tab, Shift+Tab, Escape, arrows, Home, End, -Insert, Delete, Page Up/Down and F1–F12 send the usual xterm sequences. -Ctrl+letter sends the matching control code; Alt+key prefixes ESC. - -## Supported - -- Cursor movement (`A B C D E F G H f d`), insert/delete (`@ P L M X`), erase - (`J K`), scroll (`S T`) -- SGR attributes (`0 1 2 3 4 7 22 23 24 27`) and 16/256 colour - (`30-37 40-47 90-97 100-107 38;5 48;5 38;2 48;2`) -- `ESC 7`/`ESC 8` and `CSI s`/`CSI u` cursor save/restore, `ESC M` reverse index -- `CSI ? 25 h/l` cursor visibility, UTF-8 output, tab, bell - -## Not supported - -Scroll regions (`CSI r`), alternate screen buffers, scrollback, mouse reporting, -text selection/clipboard, and OSC title or clipboard sequences. Unrecognised -sequences are parsed and ignored rather than printed literally.