def write_yx(self, offset: YX, msg: str) -> None:
'Starting at offset, write line with msg, padded at end with spaces.'
print(self._blessed.move_yx(offset.y, offset.x), end='')
- len_with_offset = offset.x + self._blessed.length(msg)
+ # ._blessed.length can slow down things notably, only use where needed
+ len_with_offset = offset.x + (len(msg) if msg.isascii()
+ else self._blessed.length(msg))
if len_with_offset > self.size.x:
print(self._blessed.truncate(msg, self.size.x - offset.x), end='')
else:
self.tags: dict[str, str] = tags or {}
def __str__(self) -> str:
- return f'[{self.tags}[{self.source}[{self.verb}]]][{self.parameters}]'
+ return f'[{self.tags}[{self.source}][{self.verb}]]][{self.parameters}]'
@classmethod
def from_raw(cls, raw_msg: str) -> Self: