Moth

Graphics and terminal rendering

Display images and use 24-bit truecolor, Unicode and Nerd Font glyphs.

Terminal capabilities

Moth uses SwiftTerm to interpret terminal output from local PTY shells. It handles ANSI and VT control sequences, 256 indexed colours, 24-bit truecolor, Unicode, alternate screens, mouse reporting, bracketed paste and terminal resizing.

SGR 5 and SGR 6 text blink once per second. SGR 25 turns blinking off. Blink works with bold, underline and inverse video, and keeps cell backgrounds visible during the hidden phase. The timer stops when the view has no visible blinking text.

CoreText and CoreGraphics render text in native AppKit views. Metal renders the optional animated background.

VT line sizes and display modes

VT100 double-width and double-height lines are enabled by default. Programs can use ESC # 6 for double width, ESC # 3 and ESC # 4 for the top and bottom halves of double-height text, and ESC # 5 to restore normal line size. Both halves must contain the same text. Double-size lines have half the normal number of character columns.

Settings → Advanced → Terminal compatibility controls this capability for all profiles. Turning it off returns existing double-size lines to normal and ignores further line-size requests. Changes apply to open windows without restarting their shells.

[advanced]
allowDoubleSizeLines = true

To display a double-height heading:

printf '\033#3Moth\r\n\033#4Moth\r\n\033#5'

DEC reverse-screen mode (CSI ? 5 h / CSI ? 5 l) changes the display independently of character-level inverse video. DEC backarrow-key mode (CSI ? 67 h / CSI ? 67 l) selects Backspace or Delete for the backarrow key. These modes support status queries and terminal resets.

Sixel and inline images

Sixel encodes bitmap images for display in a terminal. Install libsixel, then use img2sixel to display an image:

brew install libsixel
img2sixel image.png

You can also save the encoded image and display it later:

img2sixel image.png > image.sixel
cat image.sixel

Moth decodes the image into terminal pixels. Help → Run Graphics & Glyph Showcase opens some image, colour and glyph examples. Large images can be clipped by narrow panes, so resize them to suit the pane before displaying them.

Inline images remain attached to their terminal cells as text reflows.

Sixel input is bounded to 32 MiB per encoded image, 16,384 pixels per dimension and 16,777,216 decoded pixels. Oversized input is ignored without stopping subsequent terminal text.

Nerd Font and Powerline rendering

Nerd Fonts icons are supplied automatically by the bundled symbols font, including in bold and italic text.

Moth draws Powerline arrows and rounded caps, U+E0B0–U+E0B7, against exact cell boundaries to avoid gaps and overhangs. Box drawing, combining marks and selection use the same character grid. New sessions advertise 24-bit truecolor with COLORTERM=truecolor.