-
Notifications
You must be signed in to change notification settings - Fork 8.7k
Add scrollback source for suggestions #19133
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
base: main
Are you sure you want to change the base?
Conversation
winrt::hstring currentWorkingDirectory; | ||
winrt::hstring filter; | ||
|
||
bool sortResults = source == SuggestionsSource::Scrollback; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the scroll back source having matches with the highest score and then the ordinal sort first felt like it had the best UX.
{ | ||
// Reverse the list | ||
std::reverse(std::begin(actions), std::end(actions)); | ||
constexpr std::size_t MaxResults = 1000; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if this is ok, when I was profiling this with 36k results, it was bothering me that the sort was using the same amount of CPU as the fuzzy search.
//300 is the max height of the listView, this may need to be adjusted to include the description height and gap. | ||
const bool estimateCanOpenDownwards = (_anchor.Y + 300) < space.Height; | ||
_setDirection(estimateCanOpenDownwards ? TerminalApp::SuggestionsDirection::TopDown : | ||
TerminalApp::SuggestionsDirection::BottomUp); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For this, I was running into a issue where the first time I would open the control from bottom up, the results wouldn't be sorted in reverse, it looked like this was because canOpenDownwards was being calculated after the sort. I used the hard coded 300 because I think canOpenDownward depends on the items being set in the control.
Style="{StaticResource NoAnimationsPlease}" /> | ||
Style="{StaticResource NoAnimationsPlease}"> | ||
<ListView.ItemContainerTransitions> | ||
<TransitionCollection/> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if this is ok, I removed the content transition.
- On Windows 11 when I searched it seemed like _scrollIntoView didn't do anything and the selected item would drift to the middle of the results, unless I used ReplaceAll when setting the items.
- On Windows 10 when I used ReplaceAll the animations were extremely noisy
** Removing the content transitions caused the noise to go away.
I didn't notice any difference when using the other sources on both Windows 10 and Windows 11 after I did this but I may not have tested it through enough.
@@ -67,6 +67,12 @@ namespace Microsoft.Terminal.Control | |||
Boolean SearchRegexInvalid; | |||
}; | |||
|
|||
struct SuggestionSearchItem | |||
{ | |||
String Row; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This copies the entire row contents for every word for the control Description, this was really useful for context. An alternative to copying this would be to set the RowNumber here and have the control ask for the line text each time an item is selected.
This is what that change would look like. 29cec5b
798dd09
to
23984a0
Compare
23984a0
to
12c0a48
Compare
Summary of the Pull Request
Adds scroll back source to suggestions
There were 2 things that are different about this from my original screenshot in the feature request.
I am not 100% sure on the performance of this. When I list out all of the paths in my home dir and search, the UI stutters in debug mode but doesn't in the release build. (I tried this on a really slow windows 10 machine with the release build and couldn't see any delay).
suggestions.mp4
References and Relevant Issues
Detailed Description of the Pull Request / Additional comments
Validation Steps Performed
PR Checklist