protected boolean removeEldestEntry(Map.Entry<VtLine, TerminalLayout> eldest) {
			return size() >= bufPrimary.size() + bufAlternate.size();
		}
The terminal layout model.

<p>
This, the buffers, and the parser, comprise the core logic of the terminal emulator. This
implements the Ghidra layout model, as well as the handler methods of the VT100 parser. Most of
the commands it dispatches to the current buffer. A few others modify some flags, e.g., the
handling of mouse events. Another swaps between buffers, etc. This layout model then maps each
line to a {@link TerminalLayout}. Unlike some other layout models, this does not create a new
layout whenever a line is mutated. Given the frequency with which the terminal contents change,
that would generate a decent bit of garbage. The "layout" instead dynamically computes its
properties from the mutable line object and paints straight from its buffers.
Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/terminal/TerminalLayoutModel.java