From 90bcdf9829ebc4ce1636f887cd2b032046078d9c Mon Sep 17 00:00:00 2001 From: silverwind Date: Wed, 12 Jun 2024 17:23:42 +0200 Subject: [PATCH] Fix line number widths (#31341) Fixes regression https://github.com/go-gitea/gitea/pull/31307#issuecomment-2162554913 Table CSS is weird. A `auto` value does not work and causes the regression while any pixel value causes another regression in diff where the code lines do not stretch. Partially revert that PR and clean up some related too-deep CSS selectors. Screenshot 2024-06-12 at 15 07 22 Screenshot 2024-06-12 at 15 07 43 Screenshot 2024-06-12 at 15 07 07 Screenshot 2024-06-12 at 15 07 14 --- web_src/css/base.css | 9 +++++++++ web_src/css/repo.css | 8 -------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/web_src/css/base.css b/web_src/css/base.css index 3bdcde99f6..eef4eb6eff 100644 --- a/web_src/css/base.css +++ b/web_src/css/base.css @@ -1001,6 +1001,13 @@ overflow-menu .ui.label { padding: 0 8px; text-align: right !important; color: var(--color-text-light-2); + width: 1%; /* this apparently needs to be a percentage so that code column stretches in diffs */ + min-width: 72px; + white-space: nowrap; +} + +.code-diff .lines-num { + min-width: 50px; } .lines-num span.bottom-line::after { @@ -1020,6 +1027,7 @@ overflow-menu .ui.label { .lines-type-marker { vertical-align: top; + white-space: nowrap; } .lines-num, @@ -1052,6 +1060,7 @@ overflow-menu .ui.label { .lines-escape { width: 0; + white-space: nowrap; } .lines-code { diff --git a/web_src/css/repo.css b/web_src/css/repo.css index e44bc9811b..0e3d06650e 100644 --- a/web_src/css/repo.css +++ b/web_src/css/repo.css @@ -1555,8 +1555,6 @@ td .commit-summary { .repository .diff-file-box .file-body.file-code .lines-num { text-align: right; - width: 1%; - min-width: 50px; } .repository .diff-file-box .file-body.file-code .lines-num span.fold { @@ -1582,12 +1580,6 @@ td .commit-summary { table-layout: fixed; } -.repository .diff-file-box .code-diff tbody tr td.lines-num, -.repository .diff-file-box .code-diff tbody tr td.lines-escape, -.repository .diff-file-box .code-diff tbody tr td.lines-type-marker { - white-space: nowrap; -} - .repository .diff-file-box .code-diff tbody tr td.center { text-align: center; }