Skip to content

Commit 4fb5189

Browse files
committed
Include a space if we consider the accept suggestion word is complete.
Also update 'MayAddToHistory' to trim the trailing spaces of the command to be added.
1 parent 9160c6b commit 4fb5189

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

PSReadLine/History.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,7 @@ private string MaybeAddToHistory(
185185
bool fromDifferentSession = false,
186186
bool fromInitialRead = false)
187187
{
188+
result = result.TrimEnd();
188189
var addToHistoryOption = GetAddToHistoryOption(result);
189190
if (addToHistoryOption != AddToHistoryOption.SkipAdding)
190191
{

PSReadLine/Words.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,13 @@ private int FindForwardSuggestionWordPoint(int currentIndex, string wordDelimite
130130
{
131131
if (!InWord(_suggestionText, i, wordDelimiters))
132132
{
133+
if (_suggestionText[i] == ' ')
134+
{
135+
// If the end of this suggestion word is a space, then we consider the word
136+
// is complete and include the space in the accepted suggestion word.
137+
i++;
138+
}
139+
133140
break;
134141
}
135142
}

0 commit comments

Comments
 (0)