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.

<img width="109" alt="Screenshot 2024-06-12 at 15 07 22"
src="https://github.com/go-gitea/gitea/assets/115237/756c5dea-44b8-49f9-8a08-acef68075f62">
<img width="119" alt="Screenshot 2024-06-12 at 15 07 43"
src="https://github.com/go-gitea/gitea/assets/115237/28ae1adc-118e-4016-8d09-033b9f1c9a6f">
<img width="151" alt="Screenshot 2024-06-12 at 15 07 07"
src="https://github.com/go-gitea/gitea/assets/115237/08db7ed9-de4e-405e-874d-c7ebe3082557">
<img width="141" alt="Screenshot 2024-06-12 at 15 07 14"
src="https://github.com/go-gitea/gitea/assets/115237/c4a5492b-1bf1-4773-bc8d-64eb36d823f9">
This commit is contained in:
silverwind 2024-06-12 17:23:42 +02:00 committed by GitHub
parent 21ba5ca03b
commit 90bcdf9829
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 9 additions and 8 deletions

View File

@ -1001,6 +1001,13 @@ overflow-menu .ui.label {
padding: 0 8px; padding: 0 8px;
text-align: right !important; text-align: right !important;
color: var(--color-text-light-2); 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 { .lines-num span.bottom-line::after {
@ -1020,6 +1027,7 @@ overflow-menu .ui.label {
.lines-type-marker { .lines-type-marker {
vertical-align: top; vertical-align: top;
white-space: nowrap;
} }
.lines-num, .lines-num,
@ -1052,6 +1060,7 @@ overflow-menu .ui.label {
.lines-escape { .lines-escape {
width: 0; width: 0;
white-space: nowrap;
} }
.lines-code { .lines-code {

View File

@ -1555,8 +1555,6 @@ td .commit-summary {
.repository .diff-file-box .file-body.file-code .lines-num { .repository .diff-file-box .file-body.file-code .lines-num {
text-align: right; text-align: right;
width: 1%;
min-width: 50px;
} }
.repository .diff-file-box .file-body.file-code .lines-num span.fold { .repository .diff-file-box .file-body.file-code .lines-num span.fold {
@ -1582,12 +1580,6 @@ td .commit-summary {
table-layout: fixed; 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 { .repository .diff-file-box .code-diff tbody tr td.center {
text-align: center; text-align: center;
} }