Add TmuxManager.open_aux_window delegate
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -116,3 +116,12 @@ class TmuxManager:
|
|||||||
async def set_window_label(self, window_name: str, label: str) -> None:
|
async def set_window_label(self, window_name: str, label: str) -> None:
|
||||||
"""Set the status-bar label for a window (status symbol + name)."""
|
"""Set the status-bar label for a window (status symbol + name)."""
|
||||||
await self.runner.set_window_label(window_name, label)
|
await self.runner.set_window_label(window_name, label)
|
||||||
|
|
||||||
|
async def open_aux_window(
|
||||||
|
self, name: str, cwd: str, command: list[str], label: str
|
||||||
|
) -> str | None:
|
||||||
|
"""Open a styled tool window (non-session) and switch to it.
|
||||||
|
|
||||||
|
Returns the new window_id, or None on failure.
|
||||||
|
"""
|
||||||
|
return await self.runner.new_aux_window(name, cwd, command, label)
|
||||||
|
|||||||
@@ -1083,3 +1083,14 @@ async def test_new_aux_window_kills_window_when_set_option_fails(runner):
|
|||||||
assert wid is None
|
assert wid is None
|
||||||
# the half-built window must be cleaned up by id.
|
# the half-built window must be cleaned up by id.
|
||||||
assert runner._exec.call_args_list[-1].args == ("kill-window", "-t", "@7")
|
assert runner._exec.call_args_list[-1].args == ("kill-window", "-t", "@7")
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.asyncio
|
||||||
|
async def test_manager_open_aux_window_delegates(runner):
|
||||||
|
from unittest.mock import AsyncMock
|
||||||
|
|
||||||
|
runner.new_aux_window = AsyncMock(return_value="@4")
|
||||||
|
mgr = TmuxManager(runner)
|
||||||
|
wid = await mgr.open_aux_window("nvim", "/p", ["nvim"], "nvim · p")
|
||||||
|
assert wid == "@4"
|
||||||
|
runner.new_aux_window.assert_awaited_once_with("nvim", "/p", ["nvim"], "nvim · p")
|
||||||
|
|||||||
Reference in New Issue
Block a user