Skip to content

Commit b33e222

Browse files
authored
Rename 'PredictionColor' to 'InlinePredictionColor' (#1860)
1 parent 0c649bf commit b33e222

File tree

5 files changed

+12
-12
lines changed

5 files changed

+12
-12
lines changed

PSReadLine/Cmdlets.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ public class PSConsoleReadLineOptions
8787

8888
// Use dark black by default for the suggestion text.
8989
// Find the most suitable color using https://stackoverflow.com/a/33206814
90-
public const string DefaultPredictionColor = "\x1b[38;5;238m";
90+
public const string DefaultInlinePredictionColor = "\x1b[38;5;238m";
9191

9292
public static EditMode DefaultEditMode = RuntimeInformation.IsOSPlatform(OSPlatform.Windows)
9393
? EditMode.Windows
@@ -451,10 +451,10 @@ public object SelectionColor
451451
set => _selectionColor = VTColorUtils.AsEscapeSequence(value);
452452
}
453453

454-
public object PredictionColor
454+
public object InlinePredictionColor
455455
{
456-
get => _predictionColor;
457-
set => _predictionColor = VTColorUtils.AsEscapeSequence(value);
456+
get => _inlinePredictionColor;
457+
set => _inlinePredictionColor = VTColorUtils.AsEscapeSequence(value);
458458
}
459459

460460
internal string _defaultTokenColor;
@@ -471,7 +471,7 @@ public object PredictionColor
471471
internal string _emphasisColor;
472472
internal string _errorColor;
473473
internal string _selectionColor;
474-
internal string _predictionColor;
474+
internal string _inlinePredictionColor;
475475

476476
internal void ResetColors()
477477
{
@@ -489,7 +489,7 @@ internal void ResetColors()
489489
MemberColor = DefaultNumberColor;
490490
EmphasisColor = DefaultEmphasisColor;
491491
ErrorColor = DefaultErrorColor;
492-
PredictionColor = DefaultPredictionColor;
492+
InlinePredictionColor = DefaultInlinePredictionColor;
493493

494494
var bg = Console.BackgroundColor;
495495
if (fg == VTColorUtils.UnknownColor || bg == VTColorUtils.UnknownColor)
@@ -526,7 +526,7 @@ internal void SetColor(string property, object value)
526526
{"Number", (o, v) => o.NumberColor = v},
527527
{"Member", (o, v) => o.MemberColor = v},
528528
{"Selection", (o, v) => o.SelectionColor = v},
529-
{"Prediction", (o, v) => o.PredictionColor = v},
529+
{"InlinePrediction", (o, v) => o.InlinePredictionColor = v},
530530
};
531531

532532
Interlocked.CompareExchange(ref ColorSetters, setters, null);

PSReadLine/PSReadLine.format.ps1xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -206,8 +206,8 @@ $d = [Microsoft.PowerShell.KeyHandler]::GetGroupingDescription($_.Group)
206206
<ScriptBlock>[Microsoft.PowerShell.VTColorUtils]::FormatColor($_.ParameterColor)</ScriptBlock>
207207
</ListItem>
208208
<ListItem>
209-
<Label>PredictionColor</Label>
210-
<ScriptBlock>[Microsoft.PowerShell.VTColorUtils]::FormatColor($_.PredictionColor)</ScriptBlock>
209+
<Label>InlinePredictionColor</Label>
210+
<ScriptBlock>[Microsoft.PowerShell.VTColorUtils]::FormatColor($_.InlinePredictionColor)</ScriptBlock>
211211
</ListItem>
212212
<ListItem>
213213
<Label>SelectionColor</Label>

PSReadLine/Render.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,7 @@ void RenderOneChar(char charToRender, bool toEmphasize)
340340

341341
if (suggestion != null)
342342
{
343-
color = _options._predictionColor;
343+
color = _options._inlinePredictionColor;
344344
foreach (char charToRender in suggestion)
345345
{
346346
RenderOneChar(charToRender, toEmphasize: false);

test/SuggestionTest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ public void SetPredictionColor()
240240
TestSetup(KeyMode.Cmd);
241241
var predictionColor = MakeCombinedColor(ConsoleColor.DarkYellow, ConsoleColor.Yellow);
242242
var predictionColorToCheck = Tuple.Create(ConsoleColor.DarkYellow, ConsoleColor.Yellow);
243-
PSConsoleReadLine.SetOptions(new SetPSReadLineOption {Colors = new Hashtable(){{"Prediction", predictionColor}}});
243+
PSConsoleReadLine.SetOptions(new SetPSReadLineOption {Colors = new Hashtable(){{"InlinePrediction", predictionColor}}});
244244

245245
SetHistory("echo -bar", "eca -zoo");
246246
Test("ech", Keys(

test/UnitTestReadLine.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -509,7 +509,7 @@ private void TestSetup(KeyMode keyMode, params KeyHandler[] keyHandlers)
509509
var tokenTypes = new[]
510510
{
511511
"Default", "Comment", "Keyword", "String", "Operator", "Variable",
512-
"Command", "Parameter", "Type", "Number", "Member", "Selection", "Prediction"
512+
"Command", "Parameter", "Type", "Number", "Member", "Selection", "InlinePrediction"
513513
};
514514
var colors = new Hashtable();
515515
for (var i = 0; i < tokenTypes.Length; i++)

0 commit comments

Comments
 (0)