"""unicurses drawing helpers."""
from __future__ import annotations
from unicurses import clrtoeol, move, mvaddstr # type: ignore[import-untyped]
def draw_line(row: int, col: int, text: str, width: int, attr: int = 0) -> None:
"""Write ``text`` on one row, clipped to the terminal width."""
clipped = text[: max(0, width - col - 1)]
move(row, col)
clrtoeol()
if attr:
mvaddstr(row, col, clipped, attr)
else:
mvaddstr(row, col, clipped)