-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added Wrappers for Windows API functions GetConsoleMode
and SetConsoleMode
#19900
Conversation
- Added `GetConsoleMode` function to `std.os.windows` - Added `SetConsoleMode` function to `std.os.windows` - Added `ConsoleMode` type to `std.os.windows` - It is passed into/returned by the above functions - This is a packed union backed by a `DWORD` value - Has a field `dword` which is to be directly used in calls to the above API functions - Has a field `input` representing flags for console input buffers - Has a field `screenbuf` representing flags for console screen buffers - Removed `ENABLE_VIRTUAL_TERMINAL_PROCESSING` from `std.os.windows` - This is made redundant by `ConsoleMode.screenbuf.ENABLE_VIRTUAL_TERMINAL_PROCESSING`
Modified to utilize new interface for `GetConsoleMode` on Windows
Made all fields of `ConsoleMode` the same bit-width (`@bitSizeOf(DWORD)`)
See #18715 for a related PR and some history of the |
As it stands, the two main things holding me back from submitting this PR as is are:
|
|
|
Reading through the uses of it in https://github.com/microsoft/terminal, it seems that the main effect of this flag is to pass `CW_USEDEFAULT` into the `CreateWindowExW` parameter `X`, so documentation has been added regarding the effects of this according to https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-createwindowexw
Tweaked the doc comment on `ConsoleMode` to make it more clear that the `dword` field is for usage with the raw, unwrapped `kernel32.SetConsoleMode`/`kernel32.SetConsoleMode` functions and not their Zig-style bindings in `std.os.windows`
While resolving the conflicts, I removed the |
Closing this PR for the time being, as progress has been slow, and it is currently based off of my master branch (I thought this would be much simpler than it turned out to be) |
SetConsoleMode
function toos.windows.kernel32
GetConsoleMode
function toos.windows
SetConsoleMode
function toos.windows
ConsoleMode
type tostd.os.windows
os.windows.GetConsoleMode
os.windows.SetConsoleMode
DWORD
valuedword
which is to be directly used in calls to the above API functionsinput
representing flags for console input buffersscreenbuf
representing flags for console screen buffersENABLE_VIRTUAL_TERMINAL_PROCESSING
fromos.windows
ConsoleMode.screenbuf.ENABLE_VIRTUAL_TERMINAL_PROCESSING
fs.supportsAnsiEscapeCodes
to use this new interface