提交 5126ba50 编写于 作者: R Rob Lourens

Fix #20411 - Ensure result count updated at end

上级 2c69e4e5
......@@ -1092,7 +1092,8 @@ export class SearchViewlet extends Viewlet {
} else {
this.viewModel.searchResult.toggleHighlights(true); // show highlights
// Indicate as status to ARIA
// Indicate final search result count in viewlet label and ARIA
this.updateSearchResultCount();
aria.status(nls.localize('ariaSearchResultsStatus', "Search returned {0} results in {1} files", this.viewModel.searchResult.count(), this.viewModel.searchResult.fileCount()));
}
};
......@@ -1158,13 +1159,7 @@ export class SearchViewlet extends Viewlet {
autoExpand(false);
}).done(null, errors.onUnexpectedError);
// Update results text
const msgWasHidden = this.messages.isHidden();
const div = this.clearMessage();
$(div).p({ text: this.buildResultCountMessage(this.viewModel.searchResult.count(), fileCount) });
if (msgWasHidden) {
this.reLayout();
}
this.updateSearchResultCount();
}
if (fileCount > 0) {
// since we have results now, enable some actions
......@@ -1179,6 +1174,15 @@ export class SearchViewlet extends Viewlet {
this.viewModel.search(query).done(onComplete, onError, onProgress);
}
private updateSearchResultCount(): void {
const msgWasHidden = this.messages.isHidden();
const div = this.clearMessage();
$(div).p({ text: this.buildResultCountMessage(this.viewModel.searchResult.count(), this.viewModel.searchResult.fileCount()) });
if (msgWasHidden) {
this.reLayout();
}
}
private buildResultCountMessage(resultCount: number, fileCount: number): string {
if (resultCount === 1 && fileCount === 1) {
return nls.localize('search.file.result', "Found {0} result in {1} file", resultCount, fileCount);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册