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.

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

3535 raise KeyError(style_name)
3636
3737 for position, plain_text, tag in _parse(markup):
38+
3839 if plain_text is not None:
3940 append(emoji_replace(plain_text) if emoji else plain_text)
4041 elif tag is not None:
9293 if style:
9394 append_span(_Span(start, text_length, style))
9495
95- text.spans = sorted(spans, key=attrgetter("start", "end"))
96+ text.spans = sorted(spans[::-1], key=attrgetter("start"))
9697 return text

The check that tells the two apart

failpass·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