One function
render in Textualize/rich
The author described this change as “fix for markup span sorting”. It counts as a record because the check below fails on the code as it stood at 0c0c90a66 and passes on d04a81237, with nothing else changed between the two runs.
ProjectTextualize/rich
Fix saved2021-07-09
Sharing licenceMIT · LICENSE
Change size+2 −1
What the code was meant to do, written into the code itself as a docstring
Render console markup in to a Text instance. Args: markup (str): A string containing console markup. emoji (bool, optional): Also render emoji code. Defaults to True. Raises: MarkupError: If there is a syntax error in the markup. Returns: Text: A test instance.
The change
| 35 | 35 | raise KeyError(style_name) | |
| 36 | 36 | ||
| 37 | 37 | for position, plain_text, tag in _parse(markup): | |
| 38 | + | ||
| 38 | 39 | if plain_text is not None: | |
| 39 | 40 | append(emoji_replace(plain_text) if emoji else plain_text) | |
| 40 | 41 | elif tag is not None: | |
| ⋯ | |||
| 92 | 93 | if style: | |
| 93 | 94 | append_span(_Span(start, text_length, style)) | |
| 94 | 95 | ||
| 95 | - | text.spans = sorted(spans, key=attrgetter("start", "end")) | |
| 96 | + | text.spans = sorted(spans[::-1], key=attrgetter("start")) | |
| 96 | 97 | return text | |
The check that tells the two apart
fail→pass·tests/test_markup.py::test_adjoint
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 it0c0c90a66d606b21c6f7a18da33a3786d89e0edb
Broken version dated2021-07-09
Modulerich.markup
Units changedrender
Fingerprint400159104216b323
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