DEFAULT_TOKEN = ('C', ) + Attrs(color=None, bgcolor=None, bold=False, underline=False, italic=False, blink=False, reverse=False) class CursorPosition(object): " Mutable CursorPosition. " def __init__(self, x=0, y=0): self.x = x self.y = y def __repr__(self): return 'pymux.CursorPosition(x=%r, y=%r)' % (self.x, self.y) _CHAR_CACHE = FastDictCache(Char, size=1000 * 1000) # Custom Savepoint that also stores the Attrs. _Savepoint = namedtuple("_Savepoint", [ 'cursor_x', 'cursor_y', 'g0_charset', 'g1_charset', 'charset', 'origin', 'wrap', 'attrs', ])
def _not_equal(self, other: "Char") -> bool: # Not equal: We don't do `not char.__eq__` here, because of the # performance of calling yet another function. return self.char != other.char or self.style != other.style if not TYPE_CHECKING: __eq__ = _equal __ne__ = _not_equal def __repr__(self) -> str: return f"{self.__class__.__name__}({self.char!r}, {self.style!r})" _CHAR_CACHE: FastDictCache[Tuple[str, str], Char] = FastDictCache(Char, size=1000 * 1000) Transparent = "[transparent]" class Screen: """ Two dimensional buffer of :class:`.Char` instances. """ def __init__( self, default_char: Optional[Char] = None, initial_width: int = 0, initial_height: int = 0, ) -> None: if default_char is None: