diff --git a/clients/terminal/tui/settings.py b/clients/terminal/tui/settings.py index 0b566c8..b48910d 100644 --- a/clients/terminal/tui/settings.py +++ b/clients/terminal/tui/settings.py @@ -19,10 +19,13 @@ scroll_speed: int = 1 diff_style: str = "unified" # Maximum number of chat items rendered into the conversation panel. Older - # items stay in the in-memory model (non-destructive) but are not laid out, - # so per-token refresh cost is bounded regardless of history length. The - # render cache makes even the visible window cheap to rebuild. - max_visible_items: int = 200 + # items stay in the in-memory model (non-destructive, cap = this * 3) but + # are not laid out, so per-token refresh cost is bounded regardless of + # history length. Kept modest (60) because the cold cost is dominated by + # the one-shot mount of the whole visible window at load/switch time — + # smaller window = faster resume of a long session. The render cache makes + # the visible window cheap to rebuild once mounted. + max_visible_items: int = 60 keybinds: dict[str, str] = field(default_factory=dict) def to_dict(self) -> dict[str, Any]: diff --git a/tests/clients/test_tui_settings.py b/tests/clients/test_tui_settings.py index 0f32ccb..3ec96e0 100644 --- a/tests/clients/test_tui_settings.py +++ b/tests/clients/test_tui_settings.py @@ -36,7 +36,7 @@ assert s.mouse is True assert s.scroll_speed == 1 assert s.diff_style == "unified" - assert s.max_visible_items == 200 + assert s.max_visible_items == 60 assert s.keybinds == {} @@ -127,11 +127,11 @@ data = {"max_visible_items": 5} (tmp_state_dir / "tui.json").write_text(json.dumps(data), encoding="utf-8") loaded = TuiSettings().load() - assert loaded.max_visible_items == 200 + assert loaded.max_visible_items == 60 def test_settings_rejects_bad_max_visible_items(tmp_state_dir: Path) -> None: data = {"max_visible_items": "all"} (tmp_state_dir / "tui.json").write_text(json.dumps(data), encoding="utf-8") loaded = TuiSettings().load() - assert loaded.max_visible_items == 200 + assert loaded.max_visible_items == 60