fix(console): count spacing combining marks as one cell

Rich measures Indic marks like ि as zero width, so the --list panel border drifted on Hindi, Telugu and Tamil labels.
This commit is contained in:
imSp4rky
2026-10-15 17:36:04 -06:00
parent 614a8c5ae4
commit 71a0383258
2 changed files with 39 additions and 0 deletions
+15
View File
@@ -4,10 +4,13 @@ import logging
import math
import shutil
import sys
import unicodedata
from datetime import datetime
from functools import lru_cache
from types import ModuleType
from typing import IO, Any, Callable, Iterable, List, Literal, Mapping, Optional, TextIO, Union
import rich.cells
from rich import box
from rich._log_render import FormatTimeCallable, LogRender
from rich.color import Color, blend_rgb
@@ -414,6 +417,18 @@ def force_utf8_streams() -> None:
force_utf8_streams()
_rich_cell_size = rich.cells.get_character_cell_size
@lru_cache(maxsize=4096)
def _cell_size(character: str, *args: str) -> int:
"""Count a spacing combining mark (Mc, e.g. Devanagari ि) as one cell, as terminals draw it; Rich's table says 0."""
return 1 if unicodedata.category(character) == "Mc" else _rich_cell_size(character, *args)
rich.cells.get_character_cell_size = _cell_size
rich.cells.cached_cell_len.cache_clear()
console = ComfyConsole(
log_time=False,
log_path=False,