generated from akkadotnet/build-system-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Closed
Description
Parent: #77
Summary
Implement WindowsConsole using Windows Console API via P/Invoke for proper VT100 support and event-driven input.
Files to Create
src/Termina/Platform/WindowsConsole.cs
P/Invoke Requirements
Console Mode Flags
const uint ENABLE_VIRTUAL_TERMINAL_PROCESSING = 0x0004;
const uint ENABLE_WINDOW_INPUT = 0x0008;
const uint ENABLE_MOUSE_INPUT = 0x0010; // OptionalRequired APIs
GetStdHandle(STD_INPUT_HANDLE, STD_OUTPUT_HANDLE)GetConsoleMode()/SetConsoleMode()ReadConsoleInputW()- Read INPUT_RECORD structsWaitForSingleObjectEx()- Cancellable wait on input handleGetConsoleScreenBufferInfo()- Terminal dimensions
Input Records
[StructLayout(LayoutKind.Explicit)]
struct INPUT_RECORD
{
[FieldOffset(0)] public ushort EventType;
[FieldOffset(4)] public KEY_EVENT_RECORD KeyEvent;
[FieldOffset(4)] public WINDOW_BUFFER_SIZE_RECORD WindowBufferSizeEvent;
}Key Behaviors
- Initialize(): Enable VT100 processing + window input events
- ReadInputAsync(): Use
WaitForSingleObjectExwith timeout for cancellation, thenReadConsoleInputW - Restore(): Reset console mode to original state
- Resized: Emit when
WINDOW_BUFFER_SIZE_EVENTreceived
Acceptance Criteria
- VT100 sequences processed correctly (borders render properly)
- Event-driven input (no polling)
- Cancellable via CancellationToken
- Window resize events detected
- Console state properly restored on dispose
- Works on Windows Terminal
- Best-effort support for Cmder/ConEmu
Metadata
Metadata
Assignees
Labels
No labels