@@ -408,7 +408,10 @@ public static void RemoveKeyHandler(string[] key)
408408 {
409409 var boundFunctions = new HashSet < string > ( StringComparer . OrdinalIgnoreCase ) ;
410410
411- if ( Chord == null ) yield break ;
411+ if ( Chord == null || Chord . Length == 0 )
412+ {
413+ yield break ;
414+ }
412415
413416 foreach ( string Key in Chord )
414417 {
@@ -445,16 +448,20 @@ public static void RemoveKeyHandler(string[] key)
445448 }
446449
447450 // If in Vi mode, also check Vi's command mode list.
448- if ( PSConsoleReadLine . GetOptions ( ) . EditMode == EditMode . Vi )
451+ if ( _singleton . _options . EditMode == EditMode . Vi )
449452 {
450453 if ( _viCmdKeyMap . TryGetValue ( firstKey , out entry ) )
451454 {
452455 if ( consoleKeyChord . Length == 1 )
453456 {
454- if ( entry . BriefDescription == "Ignore" ) continue ;
457+ if ( entry . BriefDescription == "Ignore" )
458+ {
459+ continue ;
460+ }
461+
455462 yield return new PowerShell . KeyHandler
456463 {
457- Key = '<' + firstKey . KeyStr + '>' ,
464+ Key = "<" + firstKey . KeyStr + ">" ,
458465 Function = entry . BriefDescription ,
459466 Description = entry . LongDescription ,
460467 Group = GetDisplayGrouping ( entry . BriefDescription ) ,
@@ -466,10 +473,14 @@ public static void RemoveKeyHandler(string[] key)
466473 if ( _viCmdChordTable . TryGetValue ( firstKey , out var secondDispatchTable ) &&
467474 secondDispatchTable . TryGetValue ( secondKey , out entry ) )
468475 {
469- if ( entry . BriefDescription == "Ignore" ) continue ;
476+ if ( entry . BriefDescription == "Ignore" )
477+ {
478+ continue ;
479+ }
480+
470481 yield return new PowerShell . KeyHandler
471482 {
472- Key = '<' + firstKey . KeyStr + "," + secondKey . KeyStr + '>' ,
483+ Key = "<" + firstKey . KeyStr + "," + secondKey . KeyStr + ">" ,
473484 Function = entry . BriefDescription ,
474485 Description = entry . LongDescription ,
475486 Group = GetDisplayGrouping ( entry . BriefDescription ) ,
@@ -479,8 +490,6 @@ public static void RemoveKeyHandler(string[] key)
479490 }
480491 }
481492 }
482- yield break ;
483-
484493 }
485494 }
486495}
0 commit comments