Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions tests/test_tui_gateway_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -980,6 +980,14 @@ def test_complete_slash_includes_tui_details_command():
assert any(item["text"] == "/details" for item in resp["result"]["items"])


def test_complete_slash_includes_tui_mouse_command():
resp = server.handle_request(
{"id": "1", "method": "complete.slash", "params": {"text": "/mou"}}
)

assert any(item["text"] == "/mouse" for item in resp["result"]["items"])


def test_complete_slash_details_args():
resp_root = server.handle_request(
{"id": "0", "method": "complete.slash", "params": {"text": "/details"}}
Expand Down Expand Up @@ -1547,6 +1555,19 @@ def test_commands_catalog_surfaces_quick_commands(monkeypatch):
assert resp["result"]["canon"]["/notes"] == "/notes"


def test_commands_catalog_includes_tui_mouse_command():
resp = server.handle_request(
{"id": "1", "method": "commands.catalog", "params": {}}
)

pairs = dict(resp["result"]["pairs"])
tui_cat = next(c for c in resp["result"]["categories"] if c["name"] == "TUI")
tui_pairs = dict(tui_cat["pairs"])

assert "/mouse" in pairs
assert "/mouse" in tui_pairs


def test_command_dispatch_exec_nonzero_surfaces_error(monkeypatch):
monkeypatch.setattr(
server,
Expand Down
6 changes: 6 additions & 0 deletions tui_gateway/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -3354,6 +3354,7 @@ def _(rid, params: dict) -> dict:
_TUI_EXTRA: list[tuple[str, str, str]] = [
("/compact", "Toggle compact display mode", "TUI"),
("/logs", "Show recent gateway log lines", "TUI"),
("/mouse", "Toggle mouse/wheel tracking [on|off|toggle]", "TUI"),
]

# Commands that queue messages onto _pending_input in the CLI.
Expand Down Expand Up @@ -4133,6 +4134,11 @@ def _(rid, params: dict) -> dict:
"display": "/logs",
"meta": "Show recent gateway log lines",
},
{
"text": "/mouse",
"display": "/mouse",
"meta": "Toggle mouse/wheel tracking [on|off|toggle]",
},
]
for extra in extras:
if extra["text"].startswith(text_lower) and not any(
Expand Down
Loading