- Add reuse parameter to Display.init() for all backends - PygameDisplay: reuse existing SDL window via class-level flag - TerminalDisplay: skip re-init when reuse=True - WebSocketDisplay: skip server start when reuse=True - SixelDisplay, KittyDisplay, NullDisplay: ignore reuse (not applicable) - MultiDisplay: pass reuse to child displays - Update benchmark.py to reuse pygame display for effect benchmarks - Add test_websocket_e2e.py with e2e marker - Register e2e marker in pyproject.toml
44 lines
1.1 KiB
Python
44 lines
1.1 KiB
Python
"""
|
|
Multi display backend - forwards to multiple displays.
|
|
"""
|
|
|
|
|
|
class MultiDisplay:
|
|
"""Display that forwards to multiple displays.
|
|
|
|
Supports reuse - passes reuse flag to all child displays.
|
|
"""
|
|
|
|
width: int = 80
|
|
height: int = 24
|
|
|
|
def __init__(self, displays: list):
|
|
self.displays = displays
|
|
self.width = 80
|
|
self.height = 24
|
|
|
|
def init(self, width: int, height: int, reuse: bool = False) -> None:
|
|
"""Initialize all child displays with dimensions.
|
|
|
|
Args:
|
|
width: Terminal width in characters
|
|
height: Terminal height in rows
|
|
reuse: If True, use reuse mode for child displays
|
|
"""
|
|
self.width = width
|
|
self.height = height
|
|
for d in self.displays:
|
|
d.init(width, height, reuse=reuse)
|
|
|
|
def show(self, buffer: list[str]) -> None:
|
|
for d in self.displays:
|
|
d.show(buffer)
|
|
|
|
def clear(self) -> None:
|
|
for d in self.displays:
|
|
d.clear()
|
|
|
|
def cleanup(self) -> None:
|
|
for d in self.displays:
|
|
d.cleanup()
|