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

rustdoc: Align search results horizontally for easy scanning #112937

Merged
merged 5 commits into from
Jun 25, 2023
Merged
Show file tree
Hide file tree
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
2 changes: 2 additions & 0 deletions src/librustdoc/html/static/css/rustdoc.css
Original file line number Diff line number Diff line change
Expand Up @@ -891,8 +891,10 @@ so that we can apply CSS-filters to change the arrow color in themes */
color: var(--search-results-grey-color);
}
.search-results .result-name .typename {
display: inline-block;
color: var(--search-results-grey-color);
font-size: 0.875rem;
width: 6.25rem;
}

.popover {
Expand Down
4 changes: 2 additions & 2 deletions src/librustdoc/html/static/js/search.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,9 @@ const longItemTypes = [
"enum variant",
"macro",
"primitive type",
"associated type",
"assoc type",
"constant",
"associated constant",
"assoc const",
"union",
"foreign type",
"keyword",
Expand Down
3 changes: 2 additions & 1 deletion tests/rustdoc-gui/search-result-display.goml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ set-window-size: (600, 100)
assert-size: (".search-results div.desc", {"width": 566})

// The result set is all on one line.
assert-css: (".search-results .result-name > span", {"display": "inline"})
assert-css: (".search-results .result-name > span:not(.typename)", {"display": "inline"})
assert-css: (".search-results .result-name > span.typename", {"display": "inline-block"})

// Check that the crate filter `<select>` is correctly handled when it goes to next line.
// To do so we need to update the length of one of its `<option>`.
Expand Down