protected void buildLayouts() {
		int count = buffer.size();
		numIndexes = BigInteger.valueOf(count);

		buffer.forEachLine(true, (i, y, line) -> {
			if (i < layouts.size()) {
				TerminalLayout layout = layouts.get(i);
				if (layout.line == line) {
					return; // Already checked for line.clearDirty()
				}
				layout = layoutCache.computeIfAbsent(line, this::newLayout);
				layouts.set(i, layout);
			}
			else {
				TerminalLayout layout = layoutCache.computeIfAbsent(line, this::newLayout);
				layouts.add(layout);
			}
		});
	}
Create a model

@param panel the panel to receive commands from the model's VT/ANSI parser
@param charset the charset for decoding bytes to characters
@param metrics font metrics for the monospaced terminal font
@param fontSizeAdjustment the font size adjustment
@param colors a resolver for ANSI colors
Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/terminal/TerminalLayoutModel.java