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

Wrap too long type name #127418

Merged
merged 2 commits into from
Jul 19, 2024
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
8 changes: 8 additions & 0 deletions src/librustdoc/html/static/css/rustdoc.css
Original file line number Diff line number Diff line change
Expand Up @@ -2174,6 +2174,14 @@ in src-script.js and main.js
padding: 2px 4px;
box-shadow: 0 0 4px var(--main-background-color);
}

.item-table > li > .item-name {
width: 33%;
}
.item-table > li > div {
padding-bottom: 5px;
Copy link
Contributor

@cynecx cynecx Jul 22, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@GuillaumeGomez Maybe it's just me but this makes the spacing in the y-axis look so "wasteful" and a bit unnatural. Is this really necessary? Or why can't we keep the old behavior.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

word-break: break-all;
}
}

@media print {
Expand Down
1 change: 1 addition & 0 deletions tests/rustdoc-gui/src/lib2/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ pub mod too_long {
pub type ReallyLongTypeNameLongLongLong =
Option<unsafe extern "C" fn(a: *const u8, b: *const u8) -> *const u8>;

/// Short doc.
pub const ReallyLongTypeNameLongLongLongConstBecauseWhyNotAConstRightGigaGigaSupraLong: u32 = 0;

/// This also has a really long doccomment. Lorem ipsum dolor sit amet,
Expand Down
6 changes: 5 additions & 1 deletion tests/rustdoc-gui/type-declation-overflow.goml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,11 @@ assert-property: ("pre.item-decl", {"scrollWidth": "1324"})

// In the table-ish view on the module index, the name should not be wrapped more than necessary.
go-to: "file://" + |DOC_PATH| + "/lib2/too_long/index.html"
assert-property: (".item-table .struct", {"offsetWidth": "684"})

// We'll ensure that items with short documentation have the same width.
store-property: ("//*[@class='item-table']//*[@class='struct']/..", {"offsetWidth": offset_width})
assert: |offset_width| == "277"
assert-property: ("//*[@class='item-table']//*[@class='constant']/..", {"offsetWidth": |offset_width|})

// We now make the same check on type declaration...
go-to: "file://" + |DOC_PATH| + "/lib2/too_long/type.ReallyLongTypeNameLongLongLong.html"
Expand Down
Loading