Skip to main content

Module term_cap

Module term_cap 

Source
Expand description

The size cap on what a terminal pane keeps of its output (the term file in the pane’s zone). A command that prints without end (yes) was stored whole: 2.5 GB and a 4.3 GB write-ahead log in 100 s. The file is now circular: it holds the last term:storedoutputmb megabytes (50 by default, 0 for no limit), offsets stay absolute so readers that remember where they were keep working, and the parts below the window are deleted as the file grows (FileStore::trim_circular_head). Agent transcripts are a different file and are not touched.

Constants§

SETTING
The settings.json key, whole megabytes.
TERM_FILE
The block file the cap applies to.
TRIMMED_NOTICE
Written into the stream once, when the first output is dropped, so the pane (live and on reload, until it scrolls out of the window) says so.

Functions§

after_append
After data was appended to a pane’s term at offset start: bring the file to the cap, and drop the parts that fell out of its window. Returns true when output has been dropped from the file and not yet announced, and data ends where a line of text can be inserted (not inside a character or an escape sequence, which the next read of the PTY continues), so the caller can write TRIMMED_NOTICE after it. At a bad boundary the notice waits for a later append. A store error is logged and costs nothing but the trim.
apply_setting
Take the setting’s value (None: not set, or not a whole number of megabytes, which means the default). Called whenever settings change.
cap_bytes
The cap in bytes; 0 means no limit.
term_opts
The options a new term file is made with.