Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions PSReadLine/Cmdlets.cs
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ public class PSConsoleReadLineOptions
/// </summary>
public const int DefaultAnsiEscapeTimeout = 100;

public PSConsoleReadLineOptions(string hostName)
public PSConsoleReadLineOptions(string hostName, bool usingLegacyConsole)
{
ResetColors();
EditMode = DefaultEditMode;
Expand All @@ -185,7 +185,11 @@ public PSConsoleReadLineOptions(string hostName)
HistorySearchCaseSensitive = DefaultHistorySearchCaseSensitive;
HistorySaveStyle = DefaultHistorySaveStyle;
AnsiEscapeTimeout = DefaultAnsiEscapeTimeout;
PredictionSource = DefaultPredictionSource;
PredictionSource = usingLegacyConsole
? PredictionSource.None
: Environment.Version.Major < 6
? PredictionSource.History
: PredictionSource.HistoryAndPlugin;
PredictionViewStyle = DefaultPredictionViewStyle;
MaximumHistoryCount = 0;

Expand Down
5 changes: 3 additions & 2 deletions PSReadLine/KeyBindings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,8 @@ void SetDefaultWindowsBindings()
{ Keys.AltMinus, MakeKeyHandler(DigitArgument, "DigitArgument") },
{ Keys.AltQuestion, MakeKeyHandler(WhatIsKey, "WhatIsKey") },
{ Keys.AltA, MakeKeyHandler(SelectCommandArgument, "SelectCommandArgument") },
{ Keys.AltH, MakeKeyHandler(ShowParameterHelp, "ShowParameterHelp") },
{ Keys.F1, MakeKeyHandler(ShowCommandHelp, "ShowCommandHelp") },
{ Keys.F2, MakeKeyHandler(SwitchPredictionView, "SwitchPredictionView") },
{ Keys.F3, MakeKeyHandler(CharacterSearch, "CharacterSearch") },
{ Keys.ShiftF3, MakeKeyHandler(CharacterSearchBackward, "CharacterSearchBackward") },
Expand All @@ -239,8 +241,6 @@ void SetDefaultWindowsBindings()
{ Keys.AltD, MakeKeyHandler(KillWord, "KillWord") },
{ Keys.CtrlAt, MakeKeyHandler(MenuComplete, "MenuComplete") },
{ Keys.CtrlW, MakeKeyHandler(BackwardKillWord, "BackwardKillWord") },
{ Keys.AltH, MakeKeyHandler(ShowParameterHelp, "ShowParameterHelp") },
{ Keys.F1, MakeKeyHandler(ShowCommandHelp, "ShowCommandHelp") },
};

// Some bindings are not available on certain platforms
Expand Down Expand Up @@ -338,6 +338,7 @@ void SetDefaultEmacsBindings()
{ Keys.AltA, MakeKeyHandler(SelectCommandArgument, "SelectCommandArgument") },
{ Keys.AltH, MakeKeyHandler(ShowParameterHelp, "ShowParameterHelp") },
{ Keys.F1, MakeKeyHandler(ShowCommandHelp, "ShowCommandHelp") },
{ Keys.F2, MakeKeyHandler(SwitchPredictionView, "SwitchPredictionView") },
};

// Some bindings are not available on certain platforms
Expand Down
4 changes: 3 additions & 1 deletion PSReadLine/ReadLine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -686,7 +686,9 @@ private PSConsoleReadLine()
{
hostName = PSReadLine;
}
_options = new PSConsoleReadLineOptions(hostName);

bool usingLegacyConsole = _console is PlatformWindows.LegacyWin32Console;
_options = new PSConsoleReadLineOptions(hostName, usingLegacyConsole);
_prediction = new Prediction(this);
SetDefaultBindings(_options.EditMode);
}
Expand Down