compose method

String compose(
  1. String base
)

Overlays the debug panel above base using direct string manipulation.

If not enabled, returns base unchanged.

This is a lightweight alternative to using the UV Compositor, avoiding the overhead of Canvas allocation and cell-by-cell rendering.

Implementation

String compose(String base) {
  if (!enabled) return base;
  final p = panel();
  // Use cached dimensions from panel() call
  final panelH = _cachedPanelHeight;
  final x = panelX ?? (terminalWidth - panelWidth - marginRight);
  final y = panelY ?? (terminalHeight - panelH - marginBottom);

  // Fast path: overlay panel onto base using string manipulation
  return _overlayStrings(base, p, x, y, terminalWidth, terminalHeight);
}