zig
zig copied to clipboard
Added Wrappers for Windows API functions `GetConsoleMode` and `SetConsoleMode`
- Added extern
SetConsoleModefunction toos.windows.kernel32 - Added
GetConsoleModefunction toos.windows - Added
SetConsoleModefunction toos.windows - Added
ConsoleModetype tostd.os.windows- Returned by
os.windows.GetConsoleMode - Passed into
os.windows.SetConsoleMode - This is a packed union backed by a
DWORDvalue - Has a field
dwordwhich is to be directly used in calls to the above API functions - Has a field
inputrepresenting flags for console input buffers - Has a field
screenbufrepresenting flags for console screen buffers
- Returned by
- Removed
ENABLE_VIRTUAL_TERMINAL_PROCESSINGfromos.windows- This is made redundant by
ConsoleMode.screenbuf.ENABLE_VIRTUAL_TERMINAL_PROCESSING
- This is made redundant by
- Tweaked
fs.supportsAnsiEscapeCodesto use this new interface
See https://github.com/ziglang/zig/pull/18715 for a related PR and some history of the SetConsoleMode binding.
As it stands, the two main things holding me back from submitting this PR as is are:
- Most obviously, the checks for windows don't pass, and the logs for the action provide very little info. Considering that none of these changes should be breaking for the wider std, and that at one point a single Mac check failed but but then resolved itself for no discernible reason, especially given this is Windows specific code, makes me tempted to think that these checks may have failed in some sort of error, but I don't want to be so quick to jump to that conclusion, so I want to find out what might be causing this. However, the previously mentioned lack of detail in the action logs is making this difficult, as it compiles fine on my machine
- I simply haven't been able to find any documentation
ENABLE_AUTO_POSITION. The closest I've found is a few articles that mention it in passing, only remarking that it in undocumented. If anyone has details about theENABLE_AUTO_POSITIONflag, any information would be appreciated, as I am adding doc comments to each field ofConsoleMode
- I simply haven't been able to find any documentation
ENABLE_AUTO_POSITION. The closest I've found is a few articles that mention it in passing, only remarking that it in undocumented. If anyone has details about theENABLE_AUTO_POSITIONflag, any information would be appreciated, as I am adding doc comments to each field ofConsoleMode
https://github.com/microsoft/terminal/discussions/15685#discussioncomment-6419528
- I think a change you've made is inadvertently exposing/triggering a bug in the C backend (zig1.exe trying to compile Zig to zig2.c using the C backend is what's failing). I can reproduce the CI failures locally when trying to build Zig from source in this branch.
- https://github.com/ziglang/zig/pull/18715 has been merged, so you'll need to rebase and fix the conflicts
https://github.com/ziglang/zig/pull/18715 has been merged, so you'll need to rebase and fix the conflicts
While resolving the conflicts, I removed the DISABLE_NEWLINE_AUTO_RETURN declaration, as in this PR, it would be made redundant by the ConsoleMode.screenbuf.DISABLE_NEWLINE_AUTO_RETURN field, although I would like to hear if @Garfield550 wants to weigh in on this
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)