TermUI.Platform.Windows (TermUI v1.0.0)
View SourceWindows-specific terminal handling stubs.
Full Windows support requires NIFs or ports to call Win32 APIs. This module provides stubs with clear error messages for future implementation.
Requirements for Full Support
- Windows 10 build 1511+ for VT sequence support
- SetConsoleMode with ENABLE_VIRTUAL_TERMINAL_PROCESSING
- SetConsoleMode with ENABLE_VIRTUAL_TERMINAL_INPUT
- GetConsoleScreenBufferInfo for terminal size
- Console event handling for resize/focus
Future Implementation
Would require NIF wrapping:
- kernel32.dll SetConsoleMode
- kernel32.dll GetConsoleMode
- kernel32.dll GetConsoleScreenBufferInfo
- Console event loop for input
Summary
Functions
Returns terminal capability hints based only on the OS-version heuristic.
Disables VT sequence processing.
Stub for enabling VT sequence processing for the console.
Returns Windows-specific terminal information.
Checks if the current Windows version meets minimum requirements.
Returns the intended minimum Windows version for a future full implementation. Full native Windows support is not present in 1.0.
Returns terminal size on Windows.
Returns an OS-version eligibility heuristic for Windows VT sequences.
Returns the Windows version.
Functions
@spec capability_hints() :: map()
Returns terminal capability hints based only on the OS-version heuristic.
These hints describe possible VT-sequence support, not implemented native TermUI input, mouse, paste, focus, or resize support.
@spec disable_vt_processing() :: :ok
Disables VT sequence processing.
Note: Stub implementation.
@spec enable_vt_processing() :: {:ok, :stub} | {:error, String.t()}
Stub for enabling VT sequence processing for the console.
It does not change console mode. {:ok, :stub} only means the OS version
meets the intended baseline; a future NIF/port must call SetConsoleMode.
@spec info() :: map()
Returns Windows-specific terminal information.
Note: Currently returns stub data as full implementation requires NIFs.
@spec meets_minimum_version?() :: boolean()
Checks if the current Windows version meets minimum requirements.
@spec minimum_version() :: {non_neg_integer(), non_neg_integer(), non_neg_integer()}
Returns the intended minimum Windows version for a future full implementation. Full native Windows support is not present in 1.0.
@spec terminal_size() :: {pos_integer(), pos_integer()}
Returns terminal size on Windows.
Note: Stub using Erlang's :io module. For accurate results, would need GetConsoleScreenBufferInfo via NIF.
@spec vt_support_available?() :: boolean()
Returns an OS-version eligibility heuristic for Windows VT sequences.
This stub does not call GetConsoleMode, confirm that VT processing is
enabled, or indicate that TermUI's native input/resize paths are implemented.
@spec windows_version() :: {non_neg_integer(), non_neg_integer(), non_neg_integer()} | nil
Returns the Windows version.