Files
Nathan Sobo 90a292cac6 Optimize terminal rendering when clipped by parent containers
This brings the terminal element's viewport culling in line with the editor
optimization in PR #44995 and the fix in PR #45077.

## Problem

When a terminal is inside a scrollable container (e.g., the Agent Panel
thread view), it would render ALL cells during prepaint, even when the
terminal was entirely outside the viewport. This caused unnecessary CPU
usage when multiple terminal tool outputs existed in the Agent Panel.

## Solution

Calculate the intersection of the terminal's bounds with the current
content_mask (the visible viewport after all parent clipping). If the
intersection has zero area, skip all cell processing entirely.

### Important distinction between content modes:

- **ContentMode::Scrollable**: Cells use the terminal's internal coordinate
  system with negative line numbers for scrollback history. We cannot filter
  cells by screen-space row numbers, so we render all cells when visible.
  The early-exit for zero intersection handles the offscreen case.

- **ContentMode::Inline**: Cells use 0-based line numbers (no scrollback).
  We can filter cells to only those in the visible row range, using the
  same logic that existed before but now extracted into a helper function
  with proper bounds clamping to prevent the hang bug from PR #45077.

## Testing

Added comprehensive unit tests for:
- compute_visible_row_range edge cases
- Cell filtering logic for Inline mode
- Line/i32 comparison behavior

Manually verified:
- Terminal fully visible (no clipping)
- Terminal clipped from top/bottom
- Terminal completely outside viewport (renders nothing)
- Scrollable terminals with scrollback history work correctly

Release Notes:

- Improved Agent Panel performance when terminals are scrolled offscreen.
2025-12-23 09:51:56 -07:00
..
2025-10-17 18:58:14 +00:00
2025-12-16 05:10:33 +00:00
2025-12-15 20:53:50 -07:00
2025-10-17 18:58:14 +00:00
2025-11-19 12:34:41 +01:00
2025-10-17 18:58:14 +00:00
2025-10-17 18:58:14 +00:00
2025-12-15 10:14:15 +00:00
2025-10-17 18:58:14 +00:00
2025-10-17 18:58:14 +00:00
2025-11-20 22:17:50 -07:00
2025-12-17 17:31:12 -05:00
2025-10-17 18:58:14 +00:00
2025-10-17 18:58:14 +00:00
2025-10-17 18:58:14 +00:00
2025-10-17 18:58:14 +00:00
2025-10-17 18:58:14 +00:00
2025-11-11 16:10:47 +01:00
2025-12-11 15:49:10 -05:00
2025-10-17 18:58:14 +00:00
2025-12-12 06:32:30 -08:00
2025-10-17 18:58:14 +00:00
2025-10-17 18:58:14 +00:00
2025-10-17 18:58:14 +00:00
2025-10-17 18:58:14 +00:00
2025-11-07 11:36:05 +00:00
2025-10-17 18:58:14 +00:00
2025-10-17 18:58:14 +00:00
2025-10-17 18:58:14 +00:00
2025-12-21 23:50:02 +00:00
2025-10-17 18:58:14 +00:00
2025-10-17 18:58:14 +00:00
2025-12-21 23:50:02 +00:00
2025-12-17 16:14:57 +00:00