diff --git a/docs/memories/gf_routing_and_carriers.md b/docs/memories/gf_routing_and_carriers.md index 35137885..81280fd5 100644 --- a/docs/memories/gf_routing_and_carriers.md +++ b/docs/memories/gf_routing_and_carriers.md @@ -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. diff --git a/tests/test_carrier_legend_docs.py b/tests/test_carrier_legend_docs.py index 348790da..3a17a0cd 100644 --- a/tests/test_carrier_legend_docs.py +++ b/tests/test_carrier_legend_docs.py @@ -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