Functions
enable_vt_processing
0
None
▼
Enable virtual-terminal processing on Windows.
Calls ``SetConsoleMode`` with `…
enable_vt_processing
0
None
▼
def enable_vt_processing() -> None
Enable virtual-terminal processing on Windows.
CallsSetConsoleMode with ENABLE_VIRTUAL_TERMINAL_PROCESSING
so that ANSI escape sequences are interpreted by cmd.exe and
PowerShell. No-op on Unix and when stdout is not a real console.
data_dir
0
Path
▼
Return the platform-appropriate milo data directory.
* Windows: ``%LOCALAPPDAT…
data_dir
0
Path
▼
def data_dir() -> Path
Return the platform-appropriate milo data directory.
- Windows:
%LOCALAPPDATA%/milo(e.g.C:\Users\alice\AppData\Local\milo) - Unix:
~/.milo
Returns
Path
watch_terminal_resize
1
Callable[[], None]
▼
Register *callback(cols, rows)* to fire on terminal resize.
On Unix this insta…
watch_terminal_resize
1
Callable[[], None]
▼
def watch_terminal_resize(callback: Callable[[int, int], None]) -> Callable[[], None]
Register callback(cols, rows) to fire on terminal resize.
On Unix this installs aSIGWINCHhandler.
On Windows it spawns a daemon thread that pollsos.get_terminal_size().
Returns a stop callable that unregisters the handler / stops the polling thread.
Parameters
| Name | Type | Description |
|---|---|---|
callback |
Callable[[int, int], None] |
Returns
Callable[[], None]
_sigwinch_resize
1
Callable[[], None]
▼
Unix: use SIGWINCH.
_sigwinch_resize
1
Callable[[], None]
▼
def _sigwinch_resize(callback: Callable[[int, int], None]) -> Callable[[], None]
Parameters
| Name | Type | Description |
|---|---|---|
callback |
Callable[[int, int], None] |
Returns
Callable[[], None]
_poll_resize
2
Callable[[], None]
▼
Windows: poll terminal size in a daemon thread.
_poll_resize
2
Callable[[], None]
▼
def _poll_resize(callback: Callable[[int, int], None], interval: float = 0.5) -> Callable[[], None]
Parameters
| Name | Type | Description |
|---|---|---|
callback |
Callable[[int, int], None] |
|
interval |
float |
Default:0.5
|
Returns
Callable[[], None]
default_shell
0
str
▼
Detect the user's shell.
On Windows, checks for PowerShell first, then falls b…
default_shell
0
str
▼
def default_shell() -> str
Detect the user's shell.
On Windows, checks for PowerShell first, then falls back tocmd.
On Unix, reads$SHELLand maps to bash/zsh/fish.
Returns
str