Skip to content
Open
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
2 changes: 1 addition & 1 deletion strix/interface/tui/renderers/agent_message_renderer.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ def _apply_markdown_styles(text: str) -> Text: # noqa: PLR0912
result.append_text(_process_inline_formatting(line[2:]))
elif len(line) > 2 and line[0].isdigit() and line[1:3] in (". ", ") "):
result.append(line[0] + ". ", style="#22c55e")
result.append_text(_process_inline_formatting(line[2:]))
result.append_text(_process_inline_formatting(line[3:]))
elif line.strip() in ("---", "***", "___"):
result.append("─" * 40, style="#22c55e")
else:
Expand Down
33 changes: 33 additions & 0 deletions tests/test_agent_message_renderer.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
"""Tests for the agent message TUI renderer."""

from __future__ import annotations

from importlib.util import module_from_spec
from importlib.util import spec_from_file_location
from pathlib import Path


def _load_module() -> object:
module_path = Path(__file__).resolve().parents[1] / "strix" / "interface" / "tui" / "renderers" / "agent_message_renderer.py"
spec = spec_from_file_location("agent_message_renderer", module_path)
assert spec is not None
assert spec.loader is not None
module = module_from_spec(spec)
spec.loader.exec_module(module)
return module


_MODULE = _load_module()
_apply_markdown_styles = _MODULE._apply_markdown_styles


def test_ordered_list_dot_marker_uses_single_space() -> None:
assert _apply_markdown_styles("1. Hello").plain == "1. Hello"


def test_ordered_list_paren_marker_uses_single_space() -> None:
assert _apply_markdown_styles("2) World").plain == "2. World"


def test_bullet_marker_remains_single_spaced() -> None:
assert _apply_markdown_styles("- Item").plain == "• Item"