summaryrefslogtreecommitdiff
path: root/source/features/no-unnecessary-split-diff-view.css
blob: fcfda566842d6749f6ec31a99b0c2e4feba8a92e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
/* The selector looks for diff tables WITHOUT changes on the left XOR on the right */
/* Instead of duplicating this selector for each rule, we set a variable and pick it up where needed */
[rgh-no-unnecessary-split-diff-view]
	.js-diff-table:has([data-split-side]):not(
		:has([data-split-side='left']:is(.blob-code-addition, .blob-code-deletion))
	) {
	--rgh-only-additions: none;
	table-layout: auto !important;
}

[rgh-no-unnecessary-split-diff-view]
	.js-diff-table:has([data-split-side]):not(
		:has([data-split-side='right']:is(.blob-code-addition, .blob-code-deletion))
	) {
	--rgh-only-deletions: none;
	table-layout: auto !important;
}

/* Only additions: Hide the left side */
[rgh-no-unnecessary-split-diff-view]
	:is([data-hunk], .blob-expanded)
	td:nth-child(2) {
	display: var(--rgh-only-additions, table-cell) !important;
}

/* Only deletions: Hide the right side */
[rgh-no-unnecessary-split-diff-view]
	:is([data-hunk], .blob-expanded)
	td:nth-child(4) {
	display: var(--rgh-only-deletions, table-cell) !important;
}

/* Any applicable situation: Re-align annotations */
[rgh-no-unnecessary-split-diff-view]
	:is(.inline-comments, .js-inline-annotations)
	.empty-cell:not(.blob-num) {
	display: var(
		--rgh-only-additions,
		var(--rgh-only-deletions, table-cell)
	) !important;
}