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
5 changes: 3 additions & 2 deletions docs/memories/gf_routing_and_carriers.md
Original file line number Diff line number Diff line change
Expand Up @@ -325,5 +325,6 @@ naming each code by Matrix's `shortName`. Both go through
`_print_carrier_legend_line`, which collapses the whitespace runs of an entry, a
newline and a tab included, to one space, so a name cannot break the legend over
two lines. When the legend outgrows the console it breaks only between entries,
never between a code and its name; Rich breaks at any space, a no-break space
included, so `_print_carrier_legend_line` picks the break itself.
never between a code and its name, unless one entry is wider than the console;
Rich then folds that entry. Rich breaks at any space, a no-break space included,
so `_print_carrier_legend_line` picks the break itself.
14 changes: 13 additions & 1 deletion tests/test_carrier_legend_docs.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,18 @@ def test_memo_says_a_wrapped_legend_breaks_only_between_entries() -> None:
memo = " ".join(text.split())
assert (
"When the legend outgrows the console it breaks only between entries, never between a "
"code and its name; Rich breaks at any space, a no-break space included, so "
"code and its name, unless one entry is wider than the console; Rich then folds that "
"entry. Rich breaks at any space, a no-break space included, so "
"`_print_carrier_legend_line` picks the break itself."
) in memo


def test_memo_says_an_entry_wider_than_the_console_is_folded() -> None:
text = (_ROOT / "docs/memories/gf_routing_and_carriers.md").read_text()
memo = " ".join(text.split())
assert (
"When the legend outgrows the console it breaks only between entries, never between a "
"code and its name, unless one entry is wider than the console; Rich then folds that "
"entry. Rich breaks at any space, a no-break space included, so "
"`_print_carrier_legend_line` picks the break itself."
) in memo
Loading