Shortcut for ascii chars

This commit is contained in:
Will McGugan 2020-03-16 22:33:27 +00:00
parent f9db652175
commit 0882105374
1 changed files with 5 additions and 0 deletions

View File

@ -31,6 +31,11 @@ def get_character_cell_size(character: str, _table=CELL_WIDTHS) -> int:
assert len(character) == 1, "'character' should have a length of 1"
codepoint = ord(character)
if 127 > codepoint > 31:
# Shortcut for ascii
return 1
lower_bound = 0
upper_bound = len(_table) - 1
index = (lower_bound + upper_bound) // 2