201 references to ConsoleKey
dotnet-svcutil-lib (7)
CmdCredentialsProvider.cs (7)
262while (keyInfo.Key != ConsoleKey.Enter && keyInfo.Key != ConsoleKey.Escape); 265if (keyInfo.Key == ConsoleKey.Escape && throwOnEscape) 270return keyInfo.Key == ConsoleKey.Enter; 283if (keyInfo.Key == ConsoleKey.Escape) 288else if (keyInfo.Key == ConsoleKey.Backspace && userInput.Length > 0) 299while (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)
11private readonly ConsoleKey _key; 14public ConsoleKeyInfo(char keyChar, ConsoleKey key, bool shift, bool alt, bool control) 41public ConsoleKey Key
System\IO\KeyParser.cs (116)
27return new ConsoleKeyInfo(buffer[startIndex++], ConsoleKey.Backspace, false, false, false); 68ConsoleKey key; 90ConsoleKey.Enter => '\r', // "^[OM" should produce new line character (was not previously mapped this way) 91ConsoleKey.Add => '+', 92ConsoleKey.Subtract => '-', 93ConsoleKey.Divide => '/', 94ConsoleKey.Multiply => '*', 109parsed = new ConsoleKeyInfo(default, ConsoleKey.F1 + input[3] - 'A', false, false, false); 178static (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+ 220static (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), 248static ConsoleKey MapEscapeSequenceNumber(byte number) 2511 or 7 => ConsoleKey.Home, 2522 => ConsoleKey.Insert, 2533 => ConsoleKey.Delete, 2544 or 8 => ConsoleKey.End, 2555 => ConsoleKey.PageUp, 2566 => ConsoleKey.PageDown, 25811 => ConsoleKey.F1, 25912 => ConsoleKey.F2, 26013 => ConsoleKey.F3, 26114 => ConsoleKey.F4, 26215 => ConsoleKey.F5, 26317 => ConsoleKey.F6, 26418 => ConsoleKey.F7, 26519 => ConsoleKey.F8, 26620 => ConsoleKey.F9, 26721 => ConsoleKey.F10, 26823 => ConsoleKey.F11, 26924 => ConsoleKey.F12, 27025 => ConsoleKey.F13, 27126 => ConsoleKey.F14, 27228 => ConsoleKey.F15, 27329 => ConsoleKey.F16, 27431 => ConsoleKey.F17, 27532 => ConsoleKey.F18, 27633 => ConsoleKey.F19, 27734 => ConsoleKey.F20, 309static ConsoleKeyInfo Create(char keyChar, ConsoleKey key, ConsoleModifiers modifiers) 318ConsoleKey key = single switch 320'\b' => ConsoleKey.Backspace, 321'\t' => ConsoleKey.Tab, 322'\r' or '\n' => ConsoleKey.Enter, 323' ' => ConsoleKey.Spacebar, 324Escape => ConsoleKey.Escape, // Ctrl+[ and Ctrl+3 are also mapped to 27. Limitation: Ctrl+[ and Ctrl+3 can't be mapped. 325Delete => 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. 355static ConsoleKey UppercaseCharacter(char single, out bool isShift) 360return ConsoleKey.A + single - 'A'; 363static ConsoleKey ControlAndLetterPressed(char single, bool isAlt, out char keyChar, out bool isCtrl) 377return ConsoleKey.A + single - 1; 380static 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)
168if (!consumeKeys && keyInfo.Key != ConsoleKey.Backspace) // backspace is the only character not written out in the below if/elses. 179if (keyInfo.Key == ConsoleKey.Enter) 191else if (keyInfo.Key == ConsoleKey.Backspace) 234else if (keyInfo.Key == ConsoleKey.Tab) 245else if (keyInfo.Key == ConsoleKey.Clear) 364default(ConsoleKey), false, false, false);
System\TerminalFormatStrings.cs (64)
101AddKey(db, TermInfo.WellKnownStrings.KeyF1, ConsoleKey.F1); 102AddKey(db, TermInfo.WellKnownStrings.KeyF2, ConsoleKey.F2); 103AddKey(db, TermInfo.WellKnownStrings.KeyF3, ConsoleKey.F3); 104AddKey(db, TermInfo.WellKnownStrings.KeyF4, ConsoleKey.F4); 105AddKey(db, TermInfo.WellKnownStrings.KeyF5, ConsoleKey.F5); 106AddKey(db, TermInfo.WellKnownStrings.KeyF6, ConsoleKey.F6); 107AddKey(db, TermInfo.WellKnownStrings.KeyF7, ConsoleKey.F7); 108AddKey(db, TermInfo.WellKnownStrings.KeyF8, ConsoleKey.F8); 109AddKey(db, TermInfo.WellKnownStrings.KeyF9, ConsoleKey.F9); 110AddKey(db, TermInfo.WellKnownStrings.KeyF10, ConsoleKey.F10); 111AddKey(db, TermInfo.WellKnownStrings.KeyF11, ConsoleKey.F11); 112AddKey(db, TermInfo.WellKnownStrings.KeyF12, ConsoleKey.F12); 113AddKey(db, TermInfo.WellKnownStrings.KeyF13, ConsoleKey.F13); 114AddKey(db, TermInfo.WellKnownStrings.KeyF14, ConsoleKey.F14); 115AddKey(db, TermInfo.WellKnownStrings.KeyF15, ConsoleKey.F15); 116AddKey(db, TermInfo.WellKnownStrings.KeyF16, ConsoleKey.F16); 117AddKey(db, TermInfo.WellKnownStrings.KeyF17, ConsoleKey.F17); 118AddKey(db, TermInfo.WellKnownStrings.KeyF18, ConsoleKey.F18); 119AddKey(db, TermInfo.WellKnownStrings.KeyF19, ConsoleKey.F19); 120AddKey(db, TermInfo.WellKnownStrings.KeyF20, ConsoleKey.F20); 121AddKey(db, TermInfo.WellKnownStrings.KeyF21, ConsoleKey.F21); 122AddKey(db, TermInfo.WellKnownStrings.KeyF22, ConsoleKey.F22); 123AddKey(db, TermInfo.WellKnownStrings.KeyF23, ConsoleKey.F23); 124AddKey(db, TermInfo.WellKnownStrings.KeyF24, ConsoleKey.F24); 125AddKey(db, TermInfo.WellKnownStrings.KeyBackspace, ConsoleKey.Backspace); 126AddKey(db, TermInfo.WellKnownStrings.KeyBackTab, ConsoleKey.Tab, shift: true, alt: false, control: false); 127AddKey(db, TermInfo.WellKnownStrings.KeyBegin, ConsoleKey.Home); 128AddKey(db, TermInfo.WellKnownStrings.KeyClear, ConsoleKey.Clear); 129AddKey(db, TermInfo.WellKnownStrings.KeyDelete, ConsoleKey.Delete); 130AddKey(db, TermInfo.WellKnownStrings.KeyDown, ConsoleKey.DownArrow); 131AddKey(db, TermInfo.WellKnownStrings.KeyEnd, ConsoleKey.End); 132AddKey(db, TermInfo.WellKnownStrings.KeyEnter, ConsoleKey.Enter); 133AddKey(db, TermInfo.WellKnownStrings.KeyHelp, ConsoleKey.Help); 134AddKey(db, TermInfo.WellKnownStrings.KeyHome, ConsoleKey.Home); 135AddKey(db, TermInfo.WellKnownStrings.KeyInsert, ConsoleKey.Insert); 136AddKey(db, TermInfo.WellKnownStrings.KeyLeft, ConsoleKey.LeftArrow); 137AddKey(db, TermInfo.WellKnownStrings.KeyPageDown, ConsoleKey.PageDown); 138AddKey(db, TermInfo.WellKnownStrings.KeyPageUp, ConsoleKey.PageUp); 139AddKey(db, TermInfo.WellKnownStrings.KeyPrint, ConsoleKey.Print); 140AddKey(db, TermInfo.WellKnownStrings.KeyRight, ConsoleKey.RightArrow); 141AddKey(db, TermInfo.WellKnownStrings.KeyScrollForward, ConsoleKey.PageDown, shift: true, alt: false, control: false); 142AddKey(db, TermInfo.WellKnownStrings.KeyScrollReverse, ConsoleKey.PageUp, shift: true, alt: false, control: false); 143AddKey(db, TermInfo.WellKnownStrings.KeySBegin, ConsoleKey.Home, shift: true, alt: false, control: false); 144AddKey(db, TermInfo.WellKnownStrings.KeySDelete, ConsoleKey.Delete, shift: true, alt: false, control: false); 145AddKey(db, TermInfo.WellKnownStrings.KeySHome, ConsoleKey.Home, shift: true, alt: false, control: false); 146AddKey(db, TermInfo.WellKnownStrings.KeySelect, ConsoleKey.Select); 147AddKey(db, TermInfo.WellKnownStrings.KeySLeft, ConsoleKey.LeftArrow, shift: true, alt: false, control: false); 148AddKey(db, TermInfo.WellKnownStrings.KeySPrint, ConsoleKey.Print, shift: true, alt: false, control: false); 149AddKey(db, TermInfo.WellKnownStrings.KeySRight, ConsoleKey.RightArrow, shift: true, alt: false, control: false); 150AddKey(db, TermInfo.WellKnownStrings.KeyUp, ConsoleKey.UpArrow); 151AddPrefixKey(db, "kLFT", ConsoleKey.LeftArrow); 152AddPrefixKey(db, "kRIT", ConsoleKey.RightArrow); 153AddPrefixKey(db, "kUP", ConsoleKey.UpArrow); 154AddPrefixKey(db, "kDN", ConsoleKey.DownArrow); 155AddPrefixKey(db, "kDC", ConsoleKey.Delete); 156AddPrefixKey(db, "kEND", ConsoleKey.End); 157AddPrefixKey(db, "kHOM", ConsoleKey.Home); 158AddPrefixKey(db, "kNXT", ConsoleKey.PageDown); 159AddPrefixKey(db, "kPRV", ConsoleKey.PageUp); 224private void AddKey(TermInfo.Database db, TermInfo.WellKnownStrings keyId, ConsoleKey key) 229private void AddKey(TermInfo.Database db, TermInfo.WellKnownStrings keyId, ConsoleKey key, bool shift, bool alt, bool control) 233KeyFormatToConsoleKey[keyFormat] = new ConsoleKeyInfo(key == ConsoleKey.Enter ? '\r' : '\0', key, shift, alt, control); 236private void AddPrefixKey(TermInfo.Database db, string extendedNamePrefix, ConsoleKey key) 248private void AddKey(TermInfo.Database db, string extendedName, ConsoleKey key, bool shift, bool alt, bool control)