201 references to ConsoleKey
dotnet-svcutil-lib (7)
CmdCredentialsProvider.cs (7)
262
while (keyInfo.Key !=
ConsoleKey
.Enter && keyInfo.Key !=
ConsoleKey
.Escape);
265
if (keyInfo.Key ==
ConsoleKey
.Escape && throwOnEscape)
270
return keyInfo.Key ==
ConsoleKey
.Enter;
283
if (keyInfo.Key ==
ConsoleKey
.Escape)
288
else if (keyInfo.Key ==
ConsoleKey
.Backspace && userInput.Length > 0)
299
while (keyInfo.Key !=
ConsoleKey
.Enter);
Microsoft.CodeAnalysis.CSharp.EditorFeatures.UnitTests (1)
Completion\CompletionProviders\EnumAndCompletionListTagCompletionProviderTests.cs (1)
1775
[InlineData(nameof(
ConsoleKey
))]
Microsoft.DotNet.XUnitAssert.Tests (2)
EquivalenceAssertsTests.cs (2)
50
[InlineData(
ConsoleKey
.A,
ConsoleKey
.A)]
mscorlib (1)
src\libraries\shims\mscorlib\ref\mscorlib.cs (1)
131
[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.
ConsoleKey
))]
netstandard (1)
netstandard.cs (1)
435
[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.
ConsoleKey
))]
System.Console (189)
System\ConsoleKeyInfo.cs (3)
11
private readonly
ConsoleKey
_key;
14
public ConsoleKeyInfo(char keyChar,
ConsoleKey
key, bool shift, bool alt, bool control)
41
public
ConsoleKey
Key
System\IO\KeyParser.cs (116)
27
return new ConsoleKeyInfo(buffer[startIndex++],
ConsoleKey
.Backspace, false, false, false);
68
ConsoleKey
key;
90
ConsoleKey
.Enter => '\r', // "^[OM" should produce new line character (was not previously mapped this way)
91
ConsoleKey
.Add => '+',
92
ConsoleKey
.Subtract => '-',
93
ConsoleKey
.Divide => '/',
94
ConsoleKey
.Multiply => '*',
109
parsed = new ConsoleKeyInfo(default,
ConsoleKey
.F1 + input[3] - 'A', false, false, false);
178
static (
ConsoleKey
key, ConsoleModifiers modifiers) MapKeyIdOXterm(char character, bool isRxvt)
181
'A' or 'x' => (
ConsoleKey
.UpArrow, 0), // lowercase used by rxvt
182
'a' => (
ConsoleKey
.UpArrow, ConsoleModifiers.Shift), // rxvt
183
'B' or 'r' => (
ConsoleKey
.DownArrow, 0), // lowercase used by rxv
184
'b' => (
ConsoleKey
.DownArrow, ConsoleModifiers.Shift), // used by rxvt
185
'C' or 'v' => (
ConsoleKey
.RightArrow, 0), // lowercase used by rxv
186
'c' => (
ConsoleKey
.RightArrow, ConsoleModifiers.Shift), // used by rxvt
187
'D' or 't' => (
ConsoleKey
.LeftArrow, 0), // lowercase used by rxv
188
'd' => (
ConsoleKey
.LeftArrow, ConsoleModifiers.Shift), // used by rxvt
189
'E' => (
ConsoleKey
.NoName, 0), // ^[OE maps to Begin, but we don't have such Key. To reproduce press Num5.
190
'F' or 'q' => (
ConsoleKey
.End, 0),
191
'H' => (
ConsoleKey
.Home, 0),
192
'j' => (
ConsoleKey
.Multiply, 0), // used by both xterm and rxvt
193
'k' => (
ConsoleKey
.Add, 0), // used by both xterm and rxvt
194
'm' => (
ConsoleKey
.Subtract, 0), // used by both xterm and rxvt
195
'M' => (
ConsoleKey
.Enter, 0), // used by xterm, rxvt (they have it Terminfo) and tmux (no record in Terminfo)
196
'n' => (
ConsoleKey
.Delete, 0), // rxvt
197
'o' => (
ConsoleKey
.Divide, 0), // used by both xterm and rxvt
198
'P' => (
ConsoleKey
.F1, 0),
199
'p' => (
ConsoleKey
.Insert, 0), // rxvt
200
'Q' => (
ConsoleKey
.F2, 0),
201
'R' => (
ConsoleKey
.F3, 0),
202
'S' => (
ConsoleKey
.F4, 0),
203
's' => (
ConsoleKey
.PageDown, 0), // rxvt
204
'T' => (
ConsoleKey
.F5, 0), // VT 100+
205
'U' => (
ConsoleKey
.F6, 0), // VT 100+
206
'u' => (
ConsoleKey
.NoName, 0), // it should be Begin, but we don't have such (press Num5 in rxvt to reproduce)
207
'V' => (
ConsoleKey
.F7, 0), // VT 100+
208
'W' => (
ConsoleKey
.F8, 0), // VT 100+
209
'w' when isRxvt => (
ConsoleKey
.Home, 0),
210
'w' when !isRxvt => (
ConsoleKey
.End, 0),
211
'X' => (
ConsoleKey
.F9, 0), // VT 100+
212
'Y' => (
ConsoleKey
.F10, 0), // VT 100+
213
'y' => (
ConsoleKey
.PageUp, 0), // rxvt
214
'Z' => (
ConsoleKey
.F11, 0), // VT 100+
215
'[' => (
ConsoleKey
.F12, 0), // VT 100+
220
static (
ConsoleKey
key, ConsoleModifiers modifiers) MapSCO(char character)
223
'A' => (
ConsoleKey
.UpArrow, 0),
224
'B' => (
ConsoleKey
.DownArrow, 0),
225
'C' => (
ConsoleKey
.RightArrow, 0),
226
'D' => (
ConsoleKey
.LeftArrow, 0),
227
'F' => (
ConsoleKey
.End, 0),
228
'G' => (
ConsoleKey
.PageDown, 0),
229
'H' => (
ConsoleKey
.Home, 0),
230
'I' => (
ConsoleKey
.PageUp, 0),
231
_ when char.IsBetween(character, 'M', 'X') => (
ConsoleKey
.F1 + character - 'M', 0),
232
_ when char.IsBetween(character, 'Y', 'Z') => (
ConsoleKey
.F1 + character - 'Y', ConsoleModifiers.Shift),
233
_ when char.IsBetween(character, 'a', 'j') => (
ConsoleKey
.F3 + character - 'a', ConsoleModifiers.Shift),
234
_ when char.IsBetween(character, 'k', 'v') => (
ConsoleKey
.F1 + character - 'k', ConsoleModifiers.Control),
235
_ when char.IsBetween(character, 'w', 'z') => (
ConsoleKey
.F1 + character - 'w', ConsoleModifiers.Control | ConsoleModifiers.Shift),
236
'@' => (
ConsoleKey
.F5, ConsoleModifiers.Control | ConsoleModifiers.Shift),
237
'[' => (
ConsoleKey
.F6, ConsoleModifiers.Control | ConsoleModifiers.Shift),
238
'<' or '\\' => (
ConsoleKey
.F7, ConsoleModifiers.Control | ConsoleModifiers.Shift), // the Spec says <, PuTTy uses \.
239
']' => (
ConsoleKey
.F8, ConsoleModifiers.Control | ConsoleModifiers.Shift),
240
'^' => (
ConsoleKey
.F9, ConsoleModifiers.Control | ConsoleModifiers.Shift),
241
'_' => (
ConsoleKey
.F10, ConsoleModifiers.Control | ConsoleModifiers.Shift),
242
'`' => (
ConsoleKey
.F11, ConsoleModifiers.Control | ConsoleModifiers.Shift),
243
'{' => (
ConsoleKey
.F12, ConsoleModifiers.Control | ConsoleModifiers.Shift),
248
static
ConsoleKey
MapEscapeSequenceNumber(byte number)
251
1 or 7 =>
ConsoleKey
.Home,
252
2 =>
ConsoleKey
.Insert,
253
3 =>
ConsoleKey
.Delete,
254
4 or 8 =>
ConsoleKey
.End,
255
5 =>
ConsoleKey
.PageUp,
256
6 =>
ConsoleKey
.PageDown,
258
11 =>
ConsoleKey
.F1,
259
12 =>
ConsoleKey
.F2,
260
13 =>
ConsoleKey
.F3,
261
14 =>
ConsoleKey
.F4,
262
15 =>
ConsoleKey
.F5,
263
17 =>
ConsoleKey
.F6,
264
18 =>
ConsoleKey
.F7,
265
19 =>
ConsoleKey
.F8,
266
20 =>
ConsoleKey
.F9,
267
21 =>
ConsoleKey
.F10,
268
23 =>
ConsoleKey
.F11,
269
24 =>
ConsoleKey
.F12,
270
25 =>
ConsoleKey
.F13,
271
26 =>
ConsoleKey
.F14,
272
28 =>
ConsoleKey
.F15,
273
29 =>
ConsoleKey
.F16,
274
31 =>
ConsoleKey
.F17,
275
32 =>
ConsoleKey
.F18,
276
33 =>
ConsoleKey
.F19,
277
34 =>
ConsoleKey
.F20,
309
static ConsoleKeyInfo Create(char keyChar,
ConsoleKey
key, ConsoleModifiers modifiers)
318
ConsoleKey
key = single switch
320
'\b' =>
ConsoleKey
.Backspace,
321
'\t' =>
ConsoleKey
.Tab,
322
'\r' or '\n' =>
ConsoleKey
.Enter,
323
' ' =>
ConsoleKey
.Spacebar,
324
Escape =>
ConsoleKey
.Escape, // Ctrl+[ and Ctrl+3 are also mapped to 27. Limitation: Ctrl+[ and Ctrl+3 can't be mapped.
325
Delete =>
ConsoleKey
.Backspace, // Ctrl+8 and Backspace are mapped to 127 (ASCII Delete key). Limitation: Ctrl+8 can't be mapped.
326
'*' =>
ConsoleKey
.Multiply, // We can't distinguish Dx+Shift and Multiply (Numeric Keypad). Limitation: Shift+Dx can't be mapped.
327
'/' =>
ConsoleKey
.Divide, // We can't distinguish OemX and Divide (Numeric Keypad). Limitation: OemX keys can't be mapped.
328
'-' =>
ConsoleKey
.Subtract, // We can't distinguish OemMinus and Subtract (Numeric Keypad). Limitation: OemMinus can't be mapped.
329
'+' =>
ConsoleKey
.Add, // We can't distinguish OemPlus and Add (Numeric Keypad). Limitation: OemPlus can't be mapped.
332
',' =>
ConsoleKey
.OemComma, // was not previously mapped this way
333
'.' =>
ConsoleKey
.OemPeriod, // was not previously mapped this way
334
_ when char.IsAsciiLetterLower(single) =>
ConsoleKey
.A + single - 'a',
336
_ when char.IsAsciiDigit(single) =>
ConsoleKey
.D0 + single - '0', // We can't distinguish DX and Ctrl+DX as they produce same values. Limitation: Ctrl+DX can't be mapped.
355
static
ConsoleKey
UppercaseCharacter(char single, out bool isShift)
360
return
ConsoleKey
.A + single - 'A';
363
static
ConsoleKey
ControlAndLetterPressed(char single, bool isAlt, out char keyChar, out bool isCtrl)
377
return
ConsoleKey
.A + single - 1;
380
static
ConsoleKey
ControlAndDigitPressed(char single, out char keyChar, out bool isCtrl)
390
'\u0000' =>
ConsoleKey
.D2, // was not previously mapped this way
391
_ =>
ConsoleKey
.D4 + single - 28
System\IO\StdInReader.cs (6)
168
if (!consumeKeys && keyInfo.Key !=
ConsoleKey
.Backspace) // backspace is the only character not written out in the below if/elses.
179
if (keyInfo.Key ==
ConsoleKey
.Enter)
191
else if (keyInfo.Key ==
ConsoleKey
.Backspace)
234
else if (keyInfo.Key ==
ConsoleKey
.Tab)
245
else if (keyInfo.Key ==
ConsoleKey
.Clear)
364
default(
ConsoleKey
), false, false, false);
System\TerminalFormatStrings.cs (64)
101
AddKey(db, TermInfo.WellKnownStrings.KeyF1,
ConsoleKey
.F1);
102
AddKey(db, TermInfo.WellKnownStrings.KeyF2,
ConsoleKey
.F2);
103
AddKey(db, TermInfo.WellKnownStrings.KeyF3,
ConsoleKey
.F3);
104
AddKey(db, TermInfo.WellKnownStrings.KeyF4,
ConsoleKey
.F4);
105
AddKey(db, TermInfo.WellKnownStrings.KeyF5,
ConsoleKey
.F5);
106
AddKey(db, TermInfo.WellKnownStrings.KeyF6,
ConsoleKey
.F6);
107
AddKey(db, TermInfo.WellKnownStrings.KeyF7,
ConsoleKey
.F7);
108
AddKey(db, TermInfo.WellKnownStrings.KeyF8,
ConsoleKey
.F8);
109
AddKey(db, TermInfo.WellKnownStrings.KeyF9,
ConsoleKey
.F9);
110
AddKey(db, TermInfo.WellKnownStrings.KeyF10,
ConsoleKey
.F10);
111
AddKey(db, TermInfo.WellKnownStrings.KeyF11,
ConsoleKey
.F11);
112
AddKey(db, TermInfo.WellKnownStrings.KeyF12,
ConsoleKey
.F12);
113
AddKey(db, TermInfo.WellKnownStrings.KeyF13,
ConsoleKey
.F13);
114
AddKey(db, TermInfo.WellKnownStrings.KeyF14,
ConsoleKey
.F14);
115
AddKey(db, TermInfo.WellKnownStrings.KeyF15,
ConsoleKey
.F15);
116
AddKey(db, TermInfo.WellKnownStrings.KeyF16,
ConsoleKey
.F16);
117
AddKey(db, TermInfo.WellKnownStrings.KeyF17,
ConsoleKey
.F17);
118
AddKey(db, TermInfo.WellKnownStrings.KeyF18,
ConsoleKey
.F18);
119
AddKey(db, TermInfo.WellKnownStrings.KeyF19,
ConsoleKey
.F19);
120
AddKey(db, TermInfo.WellKnownStrings.KeyF20,
ConsoleKey
.F20);
121
AddKey(db, TermInfo.WellKnownStrings.KeyF21,
ConsoleKey
.F21);
122
AddKey(db, TermInfo.WellKnownStrings.KeyF22,
ConsoleKey
.F22);
123
AddKey(db, TermInfo.WellKnownStrings.KeyF23,
ConsoleKey
.F23);
124
AddKey(db, TermInfo.WellKnownStrings.KeyF24,
ConsoleKey
.F24);
125
AddKey(db, TermInfo.WellKnownStrings.KeyBackspace,
ConsoleKey
.Backspace);
126
AddKey(db, TermInfo.WellKnownStrings.KeyBackTab,
ConsoleKey
.Tab, shift: true, alt: false, control: false);
127
AddKey(db, TermInfo.WellKnownStrings.KeyBegin,
ConsoleKey
.Home);
128
AddKey(db, TermInfo.WellKnownStrings.KeyClear,
ConsoleKey
.Clear);
129
AddKey(db, TermInfo.WellKnownStrings.KeyDelete,
ConsoleKey
.Delete);
130
AddKey(db, TermInfo.WellKnownStrings.KeyDown,
ConsoleKey
.DownArrow);
131
AddKey(db, TermInfo.WellKnownStrings.KeyEnd,
ConsoleKey
.End);
132
AddKey(db, TermInfo.WellKnownStrings.KeyEnter,
ConsoleKey
.Enter);
133
AddKey(db, TermInfo.WellKnownStrings.KeyHelp,
ConsoleKey
.Help);
134
AddKey(db, TermInfo.WellKnownStrings.KeyHome,
ConsoleKey
.Home);
135
AddKey(db, TermInfo.WellKnownStrings.KeyInsert,
ConsoleKey
.Insert);
136
AddKey(db, TermInfo.WellKnownStrings.KeyLeft,
ConsoleKey
.LeftArrow);
137
AddKey(db, TermInfo.WellKnownStrings.KeyPageDown,
ConsoleKey
.PageDown);
138
AddKey(db, TermInfo.WellKnownStrings.KeyPageUp,
ConsoleKey
.PageUp);
139
AddKey(db, TermInfo.WellKnownStrings.KeyPrint,
ConsoleKey
.Print);
140
AddKey(db, TermInfo.WellKnownStrings.KeyRight,
ConsoleKey
.RightArrow);
141
AddKey(db, TermInfo.WellKnownStrings.KeyScrollForward,
ConsoleKey
.PageDown, shift: true, alt: false, control: false);
142
AddKey(db, TermInfo.WellKnownStrings.KeyScrollReverse,
ConsoleKey
.PageUp, shift: true, alt: false, control: false);
143
AddKey(db, TermInfo.WellKnownStrings.KeySBegin,
ConsoleKey
.Home, shift: true, alt: false, control: false);
144
AddKey(db, TermInfo.WellKnownStrings.KeySDelete,
ConsoleKey
.Delete, shift: true, alt: false, control: false);
145
AddKey(db, TermInfo.WellKnownStrings.KeySHome,
ConsoleKey
.Home, shift: true, alt: false, control: false);
146
AddKey(db, TermInfo.WellKnownStrings.KeySelect,
ConsoleKey
.Select);
147
AddKey(db, TermInfo.WellKnownStrings.KeySLeft,
ConsoleKey
.LeftArrow, shift: true, alt: false, control: false);
148
AddKey(db, TermInfo.WellKnownStrings.KeySPrint,
ConsoleKey
.Print, shift: true, alt: false, control: false);
149
AddKey(db, TermInfo.WellKnownStrings.KeySRight,
ConsoleKey
.RightArrow, shift: true, alt: false, control: false);
150
AddKey(db, TermInfo.WellKnownStrings.KeyUp,
ConsoleKey
.UpArrow);
151
AddPrefixKey(db, "kLFT",
ConsoleKey
.LeftArrow);
152
AddPrefixKey(db, "kRIT",
ConsoleKey
.RightArrow);
153
AddPrefixKey(db, "kUP",
ConsoleKey
.UpArrow);
154
AddPrefixKey(db, "kDN",
ConsoleKey
.DownArrow);
155
AddPrefixKey(db, "kDC",
ConsoleKey
.Delete);
156
AddPrefixKey(db, "kEND",
ConsoleKey
.End);
157
AddPrefixKey(db, "kHOM",
ConsoleKey
.Home);
158
AddPrefixKey(db, "kNXT",
ConsoleKey
.PageDown);
159
AddPrefixKey(db, "kPRV",
ConsoleKey
.PageUp);
224
private void AddKey(TermInfo.Database db, TermInfo.WellKnownStrings keyId,
ConsoleKey
key)
229
private void AddKey(TermInfo.Database db, TermInfo.WellKnownStrings keyId,
ConsoleKey
key, bool shift, bool alt, bool control)
233
KeyFormatToConsoleKey[keyFormat] = new ConsoleKeyInfo(key ==
ConsoleKey
.Enter ? '\r' : '\0', key, shift, alt, control);
236
private void AddPrefixKey(TermInfo.Database db, string extendedNamePrefix,
ConsoleKey
key)
248
private void AddKey(TermInfo.Database db, string extendedName,
ConsoleKey
key, bool shift, bool alt, bool control)