Skip to content

Commit 94e1da7

Browse files
Feedback: Rename ChangePSReadlineKeyHandlerCommandBase, remove assert.
1 parent d38c962 commit 94e1da7

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

PSReadLine/Cmdlets.cs

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -596,7 +596,7 @@ protected override void EndProcessing()
596596
}
597597
}
598598

599-
public class ChangePSReadlineKeyHandlerCommand : PSCmdlet
599+
public class ChangePSReadlineKeyHandlerCommandBase : PSCmdlet
600600
{
601601
[Parameter(Position = 0, Mandatory = true)]
602602
[Alias("Key")]
@@ -623,20 +623,18 @@ protected IDisposable UseRequestedDispatchTables()
623623
WriteWarning(PSReadLineResources.NotInViMode);
624624
}
625625

626-
if (ViMode == ViMode.Insert) // default if -ViMode not specified
627-
return PSConsoleReadLine.UseViInsertModeTables();
628-
else if (ViMode == ViMode.Command)
626+
if (ViMode == ViMode.Command)
629627
return PSConsoleReadLine.UseViCommandModeTables();
630-
else
631-
System.Diagnostics.Debug.Fail("unexpected ViMode");
628+
else // default if -ViMode not specified, invalid, or "Insert"
629+
return PSConsoleReadLine.UseViInsertModeTables();
632630
}
633631

634632
return null;
635633
}
636634
}
637635

638636
[Cmdlet("Set", "PSReadlineKeyHandler", HelpUri = "http://go.microsoft.com/fwlink/?LinkId=528810")]
639-
public class SetPSReadlineKeyHandlerCommand : ChangePSReadlineKeyHandlerCommand, IDynamicParameters
637+
public class SetPSReadlineKeyHandlerCommand : ChangePSReadlineKeyHandlerCommandBase, IDynamicParameters
640638
{
641639
[Parameter(Position = 1, Mandatory = true, ParameterSetName = "ScriptBlock")]
642640
[ValidateNotNull]
@@ -755,7 +753,7 @@ protected override void EndProcessing()
755753
}
756754

757755
[Cmdlet("Remove", "PSReadlineKeyHandler", HelpUri = "http://go.microsoft.com/fwlink/?LinkId=528809")]
758-
public class RemoveKeyHandlerCommand : ChangePSReadlineKeyHandlerCommand
756+
public class RemoveKeyHandlerCommand : ChangePSReadlineKeyHandlerCommandBase
759757
{
760758
[ExcludeFromCodeCoverage]
761759
protected override void EndProcessing()

0 commit comments

Comments
 (0)