You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The former only supports basic key/mouse events (no release or unambiguous keys). Because Windows Consoles are not traditional TTYs, and they don't support SIGWINCH signals, we cannot listen to window resize events without polling the console.
Thus, it's more beneficial to work with the latter API when dealing with terminals and consoles on Windows. Using the Console API, we can listen for window resize events, and mouse/keyboard release and unambiguous events (such as ctrl+i vs tab).
The Windows Console API defines input record events as a union type. And since Go doesn't support unions, we need a way to decode and access field members. The proposed change (CL 621496) is to use encoding/binary to decode the event into its respective type using member functions.
These are not a simple Windows API additions that usually include functions, structs and consts. These contain struct methods that do not exist in Windows API.
The CLs are pretty large too.
Do we want these changes added to golang.org/x/sys/windows package? Maybe they can go into different package? Do we want this API adjusted in any way?
These are not a simple Windows API additions that usually include functions, structs and consts. These contain struct methods that do not exist in Windows API.
The first one, golang/sys#227 (CL 621515), is a simple one that adds Windows API functions, structs, and consts. The second PR golang/sys#228 builds on the first and adds struct methods that match the union type field names in the API.
Proposal Details
On Windows, reading console events can be achieved by either using Console Virtual Terminal Sequences similar to Unix terminals, or by using the Windows Console API and Buffer Events.
The former only supports basic key/mouse events (no release or unambiguous keys). Because Windows Consoles are not traditional TTYs, and they don't support
SIGWINCH
signals, we cannot listen to window resize events without polling the console.Thus, it's more beneficial to work with the latter API when dealing with terminals and consoles on Windows. Using the Console API, we can listen for window resize events, and mouse/keyboard release and unambiguous events (such as ctrl+i vs tab).
The Windows Console API defines input record events as a
union
type. And since Go doesn't support unions, we need a way to decode and access field members. The proposed change (CL 621496) is to useencoding/binary
to decode the event into its respective type using member functions.Becomes
Discussed in golang/sys#196
Related golang/sys#227
Related golang/sys#228
The text was updated successfully, but these errors were encountered: