|
2 | 2 | box-sizing: border-box; |
3 | 3 | } |
4 | 4 |
|
5 | | -.diff-column-width { |
6 | | - max-width: 101ch; |
7 | | - min-width: 40ch; |
8 | | - width: 100%; |
9 | | -} |
10 | | -.diff-column { |
11 | | - max-width: 50%; |
| 5 | +div.diff { |
| 6 | + max-width: 100%; |
| 7 | + display: table; |
12 | 8 | } |
13 | 9 |
|
14 | | -.diff-header, .line-no-header { |
15 | | - font-weight: bold; |
16 | | - border-bottom: 1px solid #ddd; |
17 | | - padding: 2px; |
| 10 | +table.diff { |
| 11 | + width: 100%; |
| 12 | + border-spacing: 0; |
18 | 13 | } |
19 | 14 |
|
20 | | -.diff-line-no { |
21 | | - display: table; /* shrink to fit longest line number */ |
| 15 | +td.code { |
| 16 | + /* this is the max width of each column of code. */ |
| 17 | + /* for table cells, `width` behaves more like `max-width`. */ |
| 18 | + width: 61ch; |
| 19 | + white-space: pre-wrap; |
| 20 | + word-wrap: break-word; |
22 | 21 | } |
23 | | -.diff-left .diff-line-no { |
24 | | - float: left; |
25 | | -} |
26 | | -.diff-right .diff-line-no { |
27 | | - float: right; |
28 | | -} |
29 | | -.diff-remainder { |
30 | | - overflow: hidden; /* see http://stackoverflow.com/questions/5540485/how-to-make-an-inline-block-element-fill-the-remainder-of-the-line */ |
| 22 | + |
| 23 | +table.diff td { |
| 24 | + vertical-align: top; |
31 | 25 | } |
32 | 26 |
|
| 27 | +/* Line numbers with thin vertical bars to indicate wrapped lines. */ |
33 | 28 | .line-no { |
34 | 29 | color: #999; |
35 | 30 | background-color: #f7f7f7; |
36 | 31 | } |
| 32 | +.line-no:first-child { |
| 33 | + background-image: |
| 34 | + linear-gradient(to left, #f7f7f7, #f7f7f7 3px, transparent, transparent 6px, #f7f7f7 6px), |
| 35 | + linear-gradient(#f7f7f7, #f7f7f7 1.4em, #aaa 1.4em); |
| 36 | +} |
| 37 | +.line-no:last-child { |
| 38 | + background-image: |
| 39 | + linear-gradient(to right, #f7f7f7, #f7f7f7 3px, transparent, transparent 6px, #f7f7f7 6px), |
| 40 | + linear-gradient(#f7f7f7, #f7f7f7 1.4em, #aaa 1.4em); |
| 41 | +} |
37 | 42 |
|
38 | | -.diff-left .line-no { |
| 43 | +table.diff .line-no:first-child { |
39 | 44 | border-right: 1px solid #ddd; |
40 | 45 | text-align: right; |
41 | 46 | } |
42 | | -.diff-right .line-no { |
| 47 | +table.diff .line-no:last-child { |
43 | 48 | border-left: 1px solid #ddd; |
44 | 49 | text-align: left; |
45 | 50 | } |
46 | | -.diff-left.diff-column { |
| 51 | +table.diff td:nth-child(2) { |
47 | 52 | border-right: 1px solid #ddd; |
48 | 53 | } |
49 | 54 |
|
50 | | -.diff-line-no, .diff-wrapper, .diff-column { |
51 | | - display: inline-block; |
52 | | - vertical-align: top; |
53 | | -} |
54 | | - |
55 | | -.diff-wrapper { |
56 | | - overflow-x: auto; |
57 | | - overflow-y: hidden; /* shouldn't happen, but we sometimes get a pixel. */ |
58 | | -} |
59 | | - |
60 | | -.diff-content { |
61 | | - display: table; /* "expand to fit" */ |
62 | | - min-width: 100%; |
63 | | -} |
64 | | - |
65 | 55 | .line-no, .code { |
66 | 56 | padding: 2px; |
67 | 57 | height: 1.11em; |
68 | | - white-space: pre; |
69 | 58 | font-family: monospace; |
70 | 59 | } |
71 | | - |
72 | | -.diff { |
73 | | - white-space: nowrap; |
74 | | -} |
75 | | - |
76 | | -.diff-wrapper, .diff-wrapper > div { |
77 | | - display: inline-block; |
78 | | - vertical-align: top; |
| 60 | +.diff .skip { |
| 61 | + text-align: center; |
| 62 | + background: #f7f7f7; |
79 | 63 | } |
80 | 64 |
|
81 | 65 | .diff .delete { |
|
85 | 69 | background-color: #efe; |
86 | 70 | } |
87 | 71 |
|
88 | | -.diff-left-content .replace { |
| 72 | +.before.replace { |
89 | 73 | background-color: #fee; |
90 | 74 | } |
91 | | -.diff-right-content .replace { |
| 75 | +.after.replace { |
92 | 76 | background-color: #efe; |
93 | 77 | } |
94 | 78 |
|
95 | | -.diff-left-content .char-replace, .diff-left-content .char-delete { |
| 79 | +.before .char-replace, .before .char-delete { |
96 | 80 | background-color: #fcc; |
97 | 81 | } |
98 | 82 |
|
99 | | -.diff-right-content .char-replace, .diff-right-content .char-insert { |
| 83 | +.after .char-replace, .after .char-insert { |
100 | 84 | background-color: #cfc; |
101 | 85 | } |
| 86 | + |
| 87 | +/* Single column selection */ |
| 88 | +.selecting-left td, |
| 89 | +.selecting-left td *, |
| 90 | +.selecting-right td, |
| 91 | +.selecting-right td * |
| 92 | +{ |
| 93 | + -moz-user-select: none; |
| 94 | + -webkit-user-select: none; |
| 95 | + -ms-user-select: none; |
| 96 | + user-select: none; |
| 97 | +} |
| 98 | + |
| 99 | +.selecting-left td.line-no::selection, |
| 100 | +.selecting-left td.line-no *::selection, |
| 101 | +.selecting-right td.line-no::selection, |
| 102 | +.selecting-right td.line-no *::selection, |
| 103 | +.selecting-left td.after::selection, |
| 104 | +.selecting-left td.after *::selection, |
| 105 | +.selecting-right td.before::selection, |
| 106 | +.selecting-right td.before *::selection |
| 107 | +{ |
| 108 | + background: transparent; |
| 109 | +} |
| 110 | + |
| 111 | +.selecting-left td.line-no::-moz-selection, |
| 112 | +.selecting-left td.line-no *::-moz-selection, |
| 113 | +.selecting-right td.line-no::-moz-selection, |
| 114 | +.selecting-right td.line-no *::-moz-selection, |
| 115 | +.selecting-left td.after::-moz-selection, |
| 116 | +.selecting-left td.after *::-moz-selection, |
| 117 | +.selecting-right td.before::-moz-selection, |
| 118 | +.selecting-right td.before *::-moz-selection |
| 119 | +{ |
| 120 | + background: transparent; |
| 121 | +} |
| 122 | + |
| 123 | +.selecting-left td.before, |
| 124 | +.selecting-left td.before *, |
| 125 | +.selecting-right td.after, |
| 126 | +.selecting-right td.after * { |
| 127 | + -moz-user-select: text; |
| 128 | + -webkit-user-select: text; |
| 129 | + -ms-user-select: text; |
| 130 | + user-select: text; |
| 131 | +} |
0 commit comments