Skip to content

Address feedback to the scrollable list view from Andy #3600

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

Merged
merged 1 commit into from
Feb 28, 2023
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
3 changes: 2 additions & 1 deletion PSReadLine/Prediction.Views.cs
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,7 @@ internal override void GetSuggestion(string userInput)
_listItems = GetHistorySuggestions(userInput, HistoryMaxCount);
if (_listItems?.Count > 0)
{
_sources = new List<SourceInfo>() { new SourceInfo(SuggestionEntry.HistorySource, _listItems.Count - 1, -1) };
_sources = new List<SourceInfo>() { new SourceInfo(SuggestionEntry.HistorySource, _listItems.Count - 1, prevSourceEndIndex: -1) };
}
}
}
Expand Down Expand Up @@ -546,6 +546,7 @@ private void AggregateSuggestions()
int count = _cacheList2[index] - num;
if (count > 0)
{
// If we had at least one source, we take the end index of the last source in the list.
int prevEndIndex = _sources.Count > 0 ? _sources[_sources.Count - 1].EndIndex : -1;
int endIndex = _listItems.Count - 1;
_sources.Add(new SourceInfo(_listItems[endIndex].Source, endIndex, prevEndIndex));
Expand Down