Skip to content

Commit f2509fb

Browse files
committed
reworked commentary to be easier to read
1 parent 0140901 commit f2509fb

File tree

1 file changed

+11
-13
lines changed

1 file changed

+11
-13
lines changed

windows/input_record.go

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,26 +3,24 @@ package windows
33
// InputRecord is the data structure that ReadConsoleInput writes into.
44
// See: https://docs.microsoft.com/en-us/windows/console/input-record-str
55
type InputRecord struct {
6-
// Type can be one of the following:
7-
// 0x1: The event is of type KEY_EVENT: https://docs.microsoft.com/en-us/windows/console/key-event-record-str
8-
// 0x2: The event is of type MOUSE_EVENT and will never be read when using ReadConsoleInput
9-
// 0x4: The event is of type WINDOW_BUFFER_SIZE_EVENT: https://docs.microsoft.com/en-us/windows/console/window-buffer-size-record-str
10-
// 0x8: The event is of type MENU_EVENT and should be ignored.
11-
// 0x10: The event is of type FOCUS_EVENT and should be ignored.
6+
// Original source: https://docs.microsoft.com/en-us/windows/console/input-record-str#members
7+
// 0x1: Key event
8+
// 0x2: Will never be read when using ReadConsoleInput
9+
// 0x4: Window buffer size event
10+
// 0x8: Deprecated
11+
// 0x10: Deprecated
1212
Type uint16
1313
_ [2]byte // discard the next two bytes
1414

1515
// Event contents can be one of:
1616
// KEY_EVENT (Type == 1)
1717
// - Event[0] is 0x1 if the key is pressed, 0x0 if the key is released
18-
// - Event[1] and Event[2] is random garbage
19-
// - Event[3] is the keycode of the pressed key. The numbers are completely different
20-
// to normal ASCII keycode, see
18+
// - Event[3] is the keycode of the pressed key, see
2119
// https://docs.microsoft.com/en-us/windows/win32/inputdev/virtual-key-codes
22-
// - Event[4] is the keyboard scan code.
23-
// - Event[5] contains the typed ascii or Unicode (not UTF8!!) keycode.
24-
// from 0x20 through 0x7f they are equal
25-
// - Event[6] stores the state of the modifier keys. See https://docs.microsoft.com/en-us/windows/console/key-event-record-str
20+
// - Event[5] is the ascii or Unicode keycode.
21+
// - Event[6] stores the state of the modifier keys.
22+
// See https://docs.microsoft.com/en-us/windows/console/key-event-record-str
23+
//
2624
// WINDOW_BUFFER_SIZE_EVENT (TYPE == 4)
2725
// - Event[0] is the new amount of character rows
2826
// - Event[1] is the new amount of character columns

0 commit comments

Comments
 (0)