@@ -326,6 +326,7 @@ static ConsoleKeyInfo CtrlAlt(char c)
326
326
public static ConsoleKeyInfo CtrlLBracket = Ctrl ( '\x1b ' ) ;
327
327
public static ConsoleKeyInfo CtrlBackslash = Ctrl ( '\x1c ' ) ;
328
328
public static ConsoleKeyInfo CtrlRBracket = Ctrl ( '\x1d ' ) ;
329
+ public static ConsoleKeyInfo CtrlCaret = RuntimeInformation . IsOSPlatform ( OSPlatform . Windows ) ? CtrlShift ( '\x1e ' ) : Ctrl ( '\x1e ' ) ;
329
330
public static ConsoleKeyInfo CtrlUnderbar = RuntimeInformation . IsOSPlatform ( OSPlatform . Windows ) ? CtrlShift ( '\x1f ' ) : Ctrl ( '\x1f ' ) ;
330
331
public static ConsoleKeyInfo CtrlBackspace = Ctrl ( RuntimeInformation . IsOSPlatform ( OSPlatform . Windows ) ? '\x7f ' : '\x08 ' ) ;
331
332
public static ConsoleKeyInfo CtrlDelete = Ctrl ( ConsoleKey . Delete ) ; // !Linux
@@ -478,13 +479,13 @@ internal static bool IgnoreKeyChar(this ConsoleKeyInfo key)
478
479
479
480
private static ConsoleModifiers NormalizeModifiers ( this ConsoleKeyInfo key )
480
481
{
482
+ var keyChar = key . IgnoreKeyChar ( ) ? key . KeyChar : key . NormalizeKeyChar ( ) ;
481
483
var result = key . Modifiers ;
482
- if ( ! char . IsControl ( key . KeyChar ) )
484
+ if ( ! char . IsControl ( keyChar ) )
483
485
{
484
486
// Ignore Shift state unless it's a control character.
485
487
result = result & ~ ConsoleModifiers . Shift ;
486
488
}
487
-
488
489
return result ;
489
490
}
490
491
@@ -537,7 +538,7 @@ internal static int GetNormalizedHashCode(this ConsoleKeyInfo obj)
537
538
// Because a comparison of two ConsoleKeyInfo objects is a comparison of the
538
539
// combination of the ConsoleKey and Modifiers, we must combine their hashes.
539
540
// Note that if the ConsoleKey is default, we must fall back to the KeyChar,
540
- // otherwise every non-special key will compare as the same.
541
+ // otherwise every non-special key will compare as the same.
541
542
int h1 = obj . IgnoreKeyChar ( )
542
543
? obj . Key . GetHashCode ( )
543
544
: obj . NormalizeKeyChar ( ) . GetHashCode ( ) ;
0 commit comments