One function

get_character_cell_size in Textualize/rich

The author described this change as fix fonts. It counts as a record because the check below fails on the code as it stood at 36fe3f7ca and passes on 73ee8232e, with nothing else changed between the two runs.

Fix saved2026-01-24
Sharing licenceMIT · LICENSE
Change size+1 1

What the code was meant to do, written into the code itself as a docstring

Get the cell size of a character. Args: character (str): A single character. unicode_version: Unicode version, `"auto"` to auto detect, `"latest"` for the latest unicode version. Returns: int: Number of cells (0, 1 or 2) occupied by that character.

The change

1111 codepoint = ord(character)
1212 table = load_cell_table(unicode_version).widths
1313 if codepoint > table[-1][1]:
14- return 0
14+ return 1
1515 lower_bound = 0
1616 upper_bound = len(table) - 1
1717 index = (lower_bound + upper_bound) // 2

The check that tells the two apart

failpass·tests/test_cells.py::test_nerd_font

Check file tests/test_cells.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 it36fe3f7ca9becca4777861d5e6e625f5a4a37545
Broken version dated2026-01-24
Modulerich.cells
Units changedget_character_cell_size
Fingerprint2109f7e000c4e044
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