diff options
| author | Jacob Hoffman-Andrews <github@hoffman-andrews.com> | 2022-01-24 20:19:09 -0800 |
|---|---|---|
| committer | Jacob Hoffman-Andrews <github@hoffman-andrews.com> | 2022-01-24 20:19:09 -0800 |
| commit | abffd4af08ac3bc4ab91cfc83ad3055529e63d57 (patch) | |
| tree | 84c0413ef62e4824edefa5873727ad8aac5924fb | |
| parent | e7825f2b690c9a0d21b6f6d84c404bb53b151b38 (diff) | |
| download | rust-abffd4af08ac3bc4ab91cfc83ad3055529e63d57.tar.gz rust-abffd4af08ac3bc4ab91cfc83ad3055529e63d57.zip | |
Add white-space: nowrap to links in the sidebar
We already have overflow: hidden on these links, but if there is a possibility to wrap, they will wrap. This happens in particular for trait implementations because the punctuation (`<>, `) introduces opportunities for breaks. That produces inconsistent UI. Fix it by forcing them not to wrap.
| -rw-r--r-- | src/librustdoc/html/static/css/rustdoc.css | 4 | ||||
| -rw-r--r-- | src/test/rustdoc-gui/sidebar.goml | 4 | ||||
| -rw-r--r-- | src/test/rustdoc-gui/src/lib2/lib.rs | 6 |
3 files changed, 14 insertions, 0 deletions
diff --git a/src/librustdoc/html/static/css/rustdoc.css b/src/librustdoc/html/static/css/rustdoc.css index 645c0aba6ac..4c79218f62a 100644 --- a/src/librustdoc/html/static/css/rustdoc.css +++ b/src/librustdoc/html/static/css/rustdoc.css @@ -484,6 +484,10 @@ nav.sub { overflow: hidden; } +.sidebar-links a { + white-space: nowrap; +} + .sidebar h2 { border-bottom: none; font-weight: 500; diff --git a/src/test/rustdoc-gui/sidebar.goml b/src/test/rustdoc-gui/sidebar.goml index ae198e41742..ef3a92ad7a6 100644 --- a/src/test/rustdoc-gui/sidebar.goml +++ b/src/test/rustdoc-gui/sidebar.goml @@ -74,3 +74,7 @@ assert-text: (".sidebar > .location", "Module sub_sub_module") assert-false: ".sidebar-elems .crate" assert-text: (".sidebar-elems .items > ul > li:nth-child(1)", "Functions") assert-text: ("#functions + .item-table .item-left > a", "foo") + +// Links to trait implementations in the sidebar should not wrap even if they are long. +goto: file://|DOC_PATH|/lib2/struct.HasALongTraitWithParams.html +assert-property: (".sidebar-links a", {"offsetHeight": 29}) diff --git a/src/test/rustdoc-gui/src/lib2/lib.rs b/src/test/rustdoc-gui/src/lib2/lib.rs index 73013c9778f..5b6d236e8e0 100644 --- a/src/test/rustdoc-gui/src/lib2/lib.rs +++ b/src/test/rustdoc-gui/src/lib2/lib.rs @@ -114,3 +114,9 @@ pub mod too_long { pub fn foo(&self) {} } } + +pub struct HasALongTraitWithParams {} + +pub trait LongTraitWithParamsBananaBananaBanana<T> {} + +impl LongTraitWithParamsBananaBananaBanana<usize> for HasALongTraitWithParams {} |
