Skip to content

Commit 8816f9e

Browse files
authored
Rollup merge of #112937 - camelid:align-typenames, r=notriddle,GuillaumeGomez
rustdoc: Align search results horizontally for easy scanning The recent PR #110688 added info about an item's kind before its name in search results. However, because the kind and name are inline with no alignment, it's now hard to visually scan downward through the search results, looking at item names. This PR fixes that by horizontally aligning search results such that there are now two columns of information. r? `@GuillaumeGomez`
2 parents f7ca9df + 9b97ae1 commit 8816f9e

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
lines changed

src/librustdoc/html/static/css/rustdoc.css

+2
Original file line numberDiff line numberDiff line change
@@ -891,8 +891,10 @@ so that we can apply CSS-filters to change the arrow color in themes */
891891
color: var(--search-results-grey-color);
892892
}
893893
.search-results .result-name .typename {
894+
display: inline-block;
894895
color: var(--search-results-grey-color);
895896
font-size: 0.875rem;
897+
width: 6.25rem;
896898
}
897899

898900
.popover {

src/librustdoc/html/static/js/search.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,9 @@ const longItemTypes = [
5252
"enum variant",
5353
"macro",
5454
"primitive type",
55-
"associated type",
55+
"assoc type",
5656
"constant",
57-
"associated constant",
57+
"assoc const",
5858
"union",
5959
"foreign type",
6060
"keyword",

tests/rustdoc-gui/search-result-display.goml

+2-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ set-window-size: (600, 100)
1414
assert-size: (".search-results div.desc", {"width": 566})
1515

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

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

0 commit comments

Comments
 (0)