Skip to content

Kathara.foundation.manager.terminal.console.WindowsConsoleAdapter

Tommaso Caiazzi edited this page Mar 19, 2026 · 1 revision

module Kathara.foundation.manager.terminal.console.WindowsConsoleAdapter

Global Variables

  • STD_INPUT_HANDLE
  • STD_OUTPUT_HANDLE
  • KEY_EVENT
  • WINDOW_BUFFER_SIZE_EVENT
  • ANSI_ESC
  • KEYCODES

class KEY_EVENT_RECORD

ctypes mapping of Win32 KEY_EVENT_RECORD structure.


class COORD

ctypes mapping of Win32 COORD structure (X, Y).


class WINDOW_BUFFER_SIZE_RECORD

ctypes mapping of Win32 WINDOW_BUFFER_SIZE_RECORD structure.


class EVENT_UNION

ctypes union mapping the Win32 INPUT_RECORD.Event union.


class INPUT_RECORD

ctypes mapping of Win32 INPUT_RECORD structure.


class WindowsConsoleAdapter

Windows-specific console adapter.

Attributes:

  • _term_handle (Optional[int]): Handle to STD_INPUT for ReadConsoleW.
  • _orig_mode (Optional[int]): Original input mode bits to restore on exit_raw().
  • _stdout_handle (int): Handle to STD_OUTPUT for WriteConsoleW.
  • _input_task (Optional[asyncio.Task]): Asyncio task pumping input events.
  • _resize_cb (Optional[Callableint, int], None): Callback invoked on console resize.

method WindowsConsoleAdapter.__init__

__init__() → None

method WindowsConsoleAdapter.enter_raw

enter_raw() → None

Put the terminal into raw mode.

Returns: None


method WindowsConsoleAdapter.exit_raw

exit_raw() → None

Restore the terminal to its previous mode (reverts "enter_raw").

Returns: None


method WindowsConsoleAdapter.install_input_reader

install_input_reader(
    loop: Any,
    on_bytes: Callable[[bytes], NoneType],
    on_close: Callable[[], NoneType]
) → None

Start reading from stdin and route incoming bytes to callbacks (connected to the manager handler).

Args:

  • loop (Any): The asyncio event loop instance used to register readers/tasks.
  • on_bytes (Callable[[bytes], None]): Callback to handle received input bytes.
  • on_close (Callable[[], None]): Callback to handle stdin closing or errors.

Returns: None


method WindowsConsoleAdapter.remove_input_reader

remove_input_reader(loop: Any) → None

Stop reading stdin previously configured by "install_input_reader".

Args:

  • loop (Any): The asyncio event loop instance used to deregister.

Returns: None


method WindowsConsoleAdapter.unwatch_resize

unwatch_resize(loop: Any) → None

Stop monitoring terminal resize events.

Args:

  • loop (Any): The asyncio event loop instance used to deregister signal handlers or callbacks.

Returns: None

Notes:

Unused, resize is read from console events.


method WindowsConsoleAdapter.watch_resize

watch_resize(loop: Any, cb: Callable[[int, int], NoneType]) → None

Start monitoring terminal resize events.

Args:

  • loop (Any): The asyncio event loop instance used to register signal handlers or callbacks.
  • cb (Callable[[int, int], None]): Callback to handle the resize.

Returns: None

Notes:

Unused, resize is read from console events, only installs the callback.


method WindowsConsoleAdapter.write_stdout

write_stdout(data: bytes) → None

Write bytes to stdout.

Args:

  • data (bytes): Bytes to write to stdout.

Returns: None


This file was automatically generated via lazydocs.

Clone this wiki locally