installed pty
[VSoRC/.git] / node_modules / node-pty / deps / winpty / misc / EnableExtendedFlags.txt
1 Note regarding ENABLE_EXTENDED_FLAGS (2016-05-30)
2
3 There is a complicated interaction between the ENABLE_EXTENDED_FLAGS flag
4 and the ENABLE_QUICK_EDIT_MODE and ENABLE_INSERT_MODE flags (presumably for
5 backwards compatibility?).  I studied the behavior on Windows 7 and Windows
6 10, with both the old and new consoles, and I didn't see any differences
7 between versions.  Here's what I seemed to observe:
8
9  - The console has three flags internally:
10     - QuickEdit
11     - InsertMode
12     - ExtendedFlags
13
14  - SetConsoleMode psuedocode:
15       void SetConsoleMode(..., DWORD mode) {
16         ExtendedFlags = (mode & (ENABLE_EXTENDED_FLAGS
17                                   | ENABLE_QUICK_EDIT_MODE
18                                   | ENABLE_INSERT_MODE    )) != 0;
19         if (ExtendedFlags) {
20           QuickEdit = (mode & ENABLE_QUICK_EDIT_MODE) != 0;
21           InsertMode = (mode & ENABLE_INSERT_MODE) != 0;
22         }
23       }
24
25  - Setting QuickEdit or InsertMode from the properties dialog GUI does not
26    affect the ExtendedFlags setting -- it simply toggles the one flag.
27
28  - GetConsoleMode psuedocode:
29       GetConsoleMode(..., DWORD *result) {
30         if (ExtendedFlags) {
31           *result |= ENABLE_EXTENDED_FLAGS;
32           if (QuickEdit) { *result |= ENABLE_QUICK_EDIT_MODE; }
33           if (InsertMode) { *result |= ENABLE_INSERT_MODE; }
34         }
35       }
36
37 Effectively, the ExtendedFlags flags controls whether the other two flags
38 are visible/controlled by the user application.  If they aren't visible,
39 though, there is no way for the user application to make them visible,
40 except by overwriting their values!  Calling SetConsoleMode with just
41 ENABLE_EXTENDED_FLAGS would clear the extended flags we want to read.
42
43 Consequently, if a program temporarily alters the QuickEdit flag (e.g. to
44 enable mouse input), it cannot restore the original values of the QuickEdit
45 and InsertMode flags, UNLESS every other console program cooperates by
46 keeping the ExtendedFlags flag set.