Skip to content

xnano_core

xnano_core

xnano-core

Modules:

  • core

    xnano_core.core

  • rust

    xnano_core.rust

Classes:

Attributes:

__version__ module-attribute

__version__: str = '0.0.17'

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to sys.getdefaultencoding(). errors defaults to 'strict'.

CoreEvent

Unified event delivered by the session event loop.

Exactly one of key, paste, mouse, or tick is populated for each kind; on Resize events both width and height are set; FocusGained / FocusLost carry no payload. Consumers should dispatch on kind and read only the associated payload field.

Attributes:

  • kind (CoreTerminalEventKind) –

    Which of the seven event kinds this event represents.

  • key (Optional[KeyEvent]) –

    Populated when kind == CoreTerminalEventKind.Key.

  • width (Optional[int]) –

    Populated when kind == CoreTerminalEventKind.Resize.

  • height (Optional[int]) –

    Populated when kind == CoreTerminalEventKind.Resize.

  • paste (Optional[str]) –

    Populated when kind == CoreTerminalEventKind.Paste.

  • mouse (Optional[MouseEvent]) –

    Populated when kind == CoreTerminalEventKind.Mouse.

  • tick (Optional[CoreTickEvent]) –

    Populated when kind == CoreTerminalEventKind.Tick.

Methods:

  • kind_str

    Return the event kind as a lowercase string.

kind_str

kind_str() -> Literal[
    "key",
    "resize",
    "paste",
    "mouse",
    "focus_gained",
    "focus_lost",
    "tick",
]

Return the event kind as a lowercase string.

CoreTerminalEventKind

Discriminator for :class:CoreEvent.

Attributes:

  • Key (CoreTerminalEventKind) –

    The event carries a keyboard :class:~xnano_core.rust.native.KeyEvent.

  • Resize (CoreTerminalEventKind) –

    The terminal reports a new size. width and height on the event are populated.

  • Paste (CoreTerminalEventKind) –

    The terminal reports bracketed-paste content. paste on the event is populated.

  • Mouse (CoreTerminalEventKind) –

    The event carries a :class:~xnano_core.rust.native.MouseEvent.

  • FocusGained (CoreTerminalEventKind) –

    The terminal window received focus. No payload.

  • FocusLost (CoreTerminalEventKind) –

    The terminal window lost focus. No payload.

  • Tick (CoreTerminalEventKind) –

    The event was synthesized by the session tick clock. tick on the event is populated with a :class:CoreTickEvent.

CoreTickEvent

Synthetic clock tick emitted by :class:CoreSession.

Ticks are only produced when the session was constructed with tick_rate_ms set. They are opt-in: a session with no configured tick interval never yields Tick events, so downstream consumers can rely on poll_event blocking purely on real input.

Attributes:

  • elapsed_ms (int) –

    Milliseconds elapsed since the previous tick was emitted (or since :meth:CoreSession.init for the first tick).