One function
escape in Textualize/rich
The author described this change as “fix escaping issue”. It counts as a record because the check below fails on the code as it stood at e3fdf3304 and passes on 193903dff, with nothing else changed between the two runs.
ProjectTextualize/rich
Fix saved2022-04-12
Sharing licenceMIT · LICENSE
Change size+2 −1
What the code was meant to do, written into the code itself as a docstring
Escapes text so that it won't be interpreted as markup. Args: markup (str): Content to be inserted in to markup. Returns: str: Markup with square brackets escaped.
The change
| 1 | 1 | def escape( | |
| 2 | - | markup: str, _escape: _EscapeSubMethod = re.compile(r"(\\*)(\[[a-z#\/@].*?\])").sub | |
| 2 | + | markup: str, | |
| 3 | + | _escape: _EscapeSubMethod = re.compile(r"(\\*)(\[[a-z#/@][^[]*?])").sub, | |
| 3 | 4 | ) -> str: | |
| 4 | 5 | """Escapes text so that it won't be interpreted as markup. | |
| 5 | 6 |
The check that tells the two apart
fail→pass·tests/test_markup.py::test_escape
Check file tests/test_markup.py, taken without changes from the fix and copied onto the older code, so the exact same check runs against both versions.
Origin and history
The code before ite3fdf3304341e8930ad913be6c67b40ef0e64457
Broken version dated2022-04-06
Modulerich.markup
Units changedescape
Fingerprint1e381f311d67022c
Checked2026-08-17 by goldset/0.1
Every field above is generated by our program. None of it is written by hand.
Other bugs found in Textualize/rich
- 2026-04-12TableDataElement
- 2026-02-01_cell_len
- 2026-01-24get_character_cell_size
- 2025-11-13Fix raw markup printed on prompt errors sometimes
- 2025-05-01fix(panel): fix title missing panel background
- 2024-10-03fix(table): highlight columns added by add_row