Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Correct highlight of replaced variables/splats with braces #984

Merged
Merged
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
4 changes: 2 additions & 2 deletions PSReadLine/Completion.cs
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ private static string GetUnquotedText(CompletionResult match, bool consistentQuo
{
if (IsQuotedVariable(s))
{
return '$' + s.Substring(2, s.Length - 3);
return s[0] + s.Substring(2, s.Length - 3);
}
return s;
}
Expand Down Expand Up @@ -731,7 +731,7 @@ private Collection<CompletionResult> FilterCompletions(CommandCompletion complet

private int FindUserCompletionTextPosition(CompletionResult match, string userCompletionText)
{
return match.ResultType == CompletionResultType.Variable && match.CompletionText[1] == '{'
return match.ResultType == CompletionResultType.Variable && userCompletionText.Length > 1 && match.CompletionText[1] == '{'
? match.CompletionText.IndexOf(userCompletionText.Substring(1), StringComparison.OrdinalIgnoreCase) - 1
: match.CompletionText.IndexOf(userCompletionText, StringComparison.OrdinalIgnoreCase);
}
Expand Down