FossilRepo

Fix diff row vertical spacing — collapse template whitespace in pre cells

lmata 2026-04-06 14:41 trunk
Commit ec8c08f6d5fc7579580e24ca7514e0cf277020d41f8d824b2427b53d2c22cffe
--- templates/fossil/checkin_detail.html
+++ templates/fossil/checkin_detail.html
@@ -10,11 +10,11 @@
1010
.diff-line-del { background: rgba(239, 68, 68, 0.1); }
1111
.diff-line-del td:last-child { color: #fca5a5; }
1212
.diff-line-hunk { background: rgba(96, 165, 250, 0.08); }
1313
.diff-line-hunk td { color: #93c5fd; font-weight: 500; }
1414
.diff-line-header td { color: #6b7280; font-weight: 600; }
15
- .diff-gutter { width: 1%; user-select: none; color: #4b5563; text-align: right; padding: 0 6px; border-right: 1px solid #374151; cursor: pointer; }
15
+ .diff-gutter { width: 1%; user-select: none; color: #4b5563; text-align: right; padding: 0 6px; border-right: 1px solid #374151; cursor: pointer; white-space: nowrap; }
1616
.diff-gutter:hover { color: #DC394C; }
1717
.diff-gutter a { color: inherit; text-decoration: none; display: block; }
1818
.line-row:target { background: rgba(220, 57, 76, 0.15) !important; }
1919
.line-row:target .diff-gutter { color: #DC394C; font-weight: 600; }
2020
.line-popover {
@@ -132,49 +132,11 @@
132132
<p class="p-4 text-sm text-gray-500">Binary file</p>
133133
{% elif fd.diff_lines %}
134134
<table class="diff-table">
135135
<tbody>
136136
{% for dl in fd.diff_lines %}
137
- {% if dl.new_num %}
138
- <tr class="diff-line-{{ dl.type }} line-row" id="diff-{{ forloop.parentloop.counter }}-R{{ dl.new_num }}">
139
- <td class="diff-gutter">{{ dl.old_num }}</td>
140
- <td class="diff-gutter" style="position:relative"
141
- x-data="{ pop: false, copied: false }"
142
- @click.stop="pop = !pop; window.location.hash = 'diff-{{ forloop.parentloop.counter }}-R{{ dl.new_num }}'"
143
- @click.outside="pop = false">
144
- {{ dl.new_num }}
145
- <div class="line-popover" x-show="pop" x-transition @click.stop>
146
- <button @click="navigator.clipboard.writeText(window.location.origin + window.location.pathname + '#diff-{{ forloop.parentloop.counter }}-R{{ dl.new_num }}'); copied = true; setTimeout(() => { copied = false; pop = false }, 1000)" :class="copied && 'copied'">
147
- <span x-show="!copied">Copy link</span><span x-show="copied">Copied!</span>
148
- </button>
149
- </div>
150
- </td>
151
- <td>{{ dl.text }}</td>
152
- </tr>
153
- {% elif dl.old_num %}
154
- <tr class="diff-line-{{ dl.type }} line-row" id="diff-{{ forloop.parentloop.counter }}-L{{ dl.old_num }}">
155
- <td class="diff-gutter" style="position:relative"
156
- x-data="{ pop: false, copied: false }"
157
- @click.stop="pop = !pop; window.location.hash = 'diff-{{ forloop.parentloop.counter }}-L{{ dl.old_num }}'"
158
- @click.outside="pop = false">
159
- {{ dl.old_num }}
160
- <div class="line-popover" x-show="pop" x-transition @click.stop>
161
- <button @click="navigator.clipboard.writeText(window.location.origin + window.location.pathname + '#diff-{{ forloop.parentloop.counter }}-L{{ dl.old_num }}'); copied = true; setTimeout(() => { copied = false; pop = false }, 1000)" :class="copied && 'copied'">
162
- <span x-show="!copied">Copy link</span><span x-show="copied">Copied!</span>
163
- </button>
164
- </div>
165
- </td>
166
- <td class="diff-gutter"></td>
167
- <td>{{ dl.text }}</td>
168
- </tr>
169
- {% else %}
170
- <tr class="diff-line-{{ dl.type }}">
171
- <td class="diff-gutter"></td>
172
- <td class="diff-gutter"></td>
173
- <td>{{ dl.text }}</td>
174
- </tr>
175
- {% endif %}
137
+{% if dl.new_num %}<tr class="diff-line-{{ dl.type }} line-row" id="diff-{{ forloop.parentloop.counter }}-R{{ dl.new_num }}"><td class="diff-gutter">{{ dl.old_num }}</td><td class="diff-gutter" style="position:relative" x-data="{ pop: false, copied: false }" @click.stop="pop = !pop; window.location.hash = 'diff-{{ forloop.parentloop.counter }}-R{{ dl.new_num }}'" @click.outside="pop = false">{{ dl.new_num }}<div class="line-popover" x-show="pop" x-transition @click.stop><button @click="navigator.clipboard.writeText(window.location.origin + window.location.pathname + '#diff-{{ forloop.parentloop.counter }}-R{{ dl.new_num }}'); copied = true; setTimeout(() => { copied = false; pop = false }, 1000)" :class="copied && 'copied'"><span x-show="!copied">Copy link</span><span x-show="copied">Copied!</span></button></div></td><td>{{ dl.text }}</td></tr>{% elif dl.old_num %}<tr class="diff-line-{{ dl.type }} line-row" id="diff-{{ forloop.parentloop.counter }}-L{{ dl.old_num }}"><td class="diff-gutter" style="position:relative" x-data="{ pop: false, copied: false }" @click.stop="pop = !pop; window.location.hash = 'diff-{{ forloop.parentloop.counter }}-L{{ dl.old_num }}'" @click.outside="pop = false">{{ dl.old_num }}<div class="line-popover" x-show="pop" x-transition @click.stop><button @click="navigator.clipboard.writeText(window.location.origin + window.location.pathname + '#diff-{{ forloop.parentloop.counter }}-L{{ dl.old_num }}'); copied = true; setTimeout(() => { copied = false; pop = false }, 1000)" :class="copied && 'copied'"><span x-show="!copied">Copy link</span><span x-show="copied">Copied!</span></button></div></td><td class="diff-gutter"></td><td>{{ dl.text }}</td></tr>{% else %}<tr class="diff-line-{{ dl.type }}"><td class="diff-gutter"></td><td class="diff-gutter"></td><td>{{ dl.text }}</td></tr>{% endif %}
176138
{% endfor %}
177139
</tbody>
178140
</table>
179141
{% else %}
180142
<p class="p-4 text-sm text-gray-500">No diff available</p>
181143
--- templates/fossil/checkin_detail.html
+++ templates/fossil/checkin_detail.html
@@ -10,11 +10,11 @@
10 .diff-line-del { background: rgba(239, 68, 68, 0.1); }
11 .diff-line-del td:last-child { color: #fca5a5; }
12 .diff-line-hunk { background: rgba(96, 165, 250, 0.08); }
13 .diff-line-hunk td { color: #93c5fd; font-weight: 500; }
14 .diff-line-header td { color: #6b7280; font-weight: 600; }
15 .diff-gutter { width: 1%; user-select: none; color: #4b5563; text-align: right; padding: 0 6px; border-right: 1px solid #374151; cursor: pointer; }
16 .diff-gutter:hover { color: #DC394C; }
17 .diff-gutter a { color: inherit; text-decoration: none; display: block; }
18 .line-row:target { background: rgba(220, 57, 76, 0.15) !important; }
19 .line-row:target .diff-gutter { color: #DC394C; font-weight: 600; }
20 .line-popover {
@@ -132,49 +132,11 @@
132 <p class="p-4 text-sm text-gray-500">Binary file</p>
133 {% elif fd.diff_lines %}
134 <table class="diff-table">
135 <tbody>
136 {% for dl in fd.diff_lines %}
137 {% if dl.new_num %}
138 <tr class="diff-line-{{ dl.type }} line-row" id="diff-{{ forloop.parentloop.counter }}-R{{ dl.new_num }}">
139 <td class="diff-gutter">{{ dl.old_num }}</td>
140 <td class="diff-gutter" style="position:relative"
141 x-data="{ pop: false, copied: false }"
142 @click.stop="pop = !pop; window.location.hash = 'diff-{{ forloop.parentloop.counter }}-R{{ dl.new_num }}'"
143 @click.outside="pop = false">
144 {{ dl.new_num }}
145 <div class="line-popover" x-show="pop" x-transition @click.stop>
146 <button @click="navigator.clipboard.writeText(window.location.origin + window.location.pathname + '#diff-{{ forloop.parentloop.counter }}-R{{ dl.new_num }}'); copied = true; setTimeout(() => { copied = false; pop = false }, 1000)" :class="copied && 'copied'">
147 <span x-show="!copied">Copy link</span><span x-show="copied">Copied!</span>
148 </button>
149 </div>
150 </td>
151 <td>{{ dl.text }}</td>
152 </tr>
153 {% elif dl.old_num %}
154 <tr class="diff-line-{{ dl.type }} line-row" id="diff-{{ forloop.parentloop.counter }}-L{{ dl.old_num }}">
155 <td class="diff-gutter" style="position:relative"
156 x-data="{ pop: false, copied: false }"
157 @click.stop="pop = !pop; window.location.hash = 'diff-{{ forloop.parentloop.counter }}-L{{ dl.old_num }}'"
158 @click.outside="pop = false">
159 {{ dl.old_num }}
160 <div class="line-popover" x-show="pop" x-transition @click.stop>
161 <button @click="navigator.clipboard.writeText(window.location.origin + window.location.pathname + '#diff-{{ forloop.parentloop.counter }}-L{{ dl.old_num }}'); copied = true; setTimeout(() => { copied = false; pop = false }, 1000)" :class="copied && 'copied'">
162 <span x-show="!copied">Copy link</span><span x-show="copied">Copied!</span>
163 </button>
164 </div>
165 </td>
166 <td class="diff-gutter"></td>
167 <td>{{ dl.text }}</td>
168 </tr>
169 {% else %}
170 <tr class="diff-line-{{ dl.type }}">
171 <td class="diff-gutter"></td>
172 <td class="diff-gutter"></td>
173 <td>{{ dl.text }}</td>
174 </tr>
175 {% endif %}
176 {% endfor %}
177 </tbody>
178 </table>
179 {% else %}
180 <p class="p-4 text-sm text-gray-500">No diff available</p>
181
--- templates/fossil/checkin_detail.html
+++ templates/fossil/checkin_detail.html
@@ -10,11 +10,11 @@
10 .diff-line-del { background: rgba(239, 68, 68, 0.1); }
11 .diff-line-del td:last-child { color: #fca5a5; }
12 .diff-line-hunk { background: rgba(96, 165, 250, 0.08); }
13 .diff-line-hunk td { color: #93c5fd; font-weight: 500; }
14 .diff-line-header td { color: #6b7280; font-weight: 600; }
15 .diff-gutter { width: 1%; user-select: none; color: #4b5563; text-align: right; padding: 0 6px; border-right: 1px solid #374151; cursor: pointer; white-space: nowrap; }
16 .diff-gutter:hover { color: #DC394C; }
17 .diff-gutter a { color: inherit; text-decoration: none; display: block; }
18 .line-row:target { background: rgba(220, 57, 76, 0.15) !important; }
19 .line-row:target .diff-gutter { color: #DC394C; font-weight: 600; }
20 .line-popover {
@@ -132,49 +132,11 @@
132 <p class="p-4 text-sm text-gray-500">Binary file</p>
133 {% elif fd.diff_lines %}
134 <table class="diff-table">
135 <tbody>
136 {% for dl in fd.diff_lines %}
137 {% if dl.new_num %}<tr class="diff-line-{{ dl.type }} line-row" id="diff-{{ forloop.parentloop.counter }}-R{{ dl.new_num }}"><td class="diff-gutter">{{ dl.old_num }}</td><td class="diff-gutter" style="position:relative" x-data="{ pop: false, copied: false }" @click.stop="pop = !pop; window.location.hash = 'diff-{{ forloop.parentloop.counter }}-R{{ dl.new_num }}'" @click.outside="pop = false">{{ dl.new_num }}<div class="line-popover" x-show="pop" x-transition @click.stop><button @click="navigator.clipboard.writeText(window.location.origin + window.location.pathname + '#diff-{{ forloop.parentloop.counter }}-R{{ dl.new_num }}'); copied = true; setTimeout(() => { copied = false; pop = false }, 1000)" :class="copied && 'copied'"><span x-show="!copied">Copy link</span><span x-show="copied">Copied!</span></button></div></td><td>{{ dl.text }}</td></tr>{% elif dl.old_num %}<tr class="diff-line-{{ dl.type }} line-row" id="diff-{{ forloop.parentloop.counter }}-L{{ dl.old_num }}"><td class="diff-gutter" style="position:relative" x-data="{ pop: false, copied: false }" @click.stop="pop = !pop; window.location.hash = 'diff-{{ forloop.parentloop.counter }}-L{{ dl.old_num }}'" @click.outside="pop = false">{{ dl.old_num }}<div class="line-popover" x-show="pop" x-transition @click.stop><button @click="navigator.clipboard.writeText(window.location.origin + window.location.pathname + '#diff-{{ forloop.parentloop.counter }}-L{{ dl.old_num }}'); copied = true; setTimeout(() => { copied = false; pop = false }, 1000)" :class="copied && 'copied'"><span x-show="!copied">Copy link</span><span x-show="copied">Copied!</span></button></div></td><td class="diff-gutter"></td><td>{{ dl.text }}</td></tr>{% else %}<tr class="diff-line-{{ dl.type }}"><td class="diff-gutter"></td><td class="diff-gutter"></td><td>{{ dl.text }}</td></tr>{% endif %}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
138 {% endfor %}
139 </tbody>
140 </table>
141 {% else %}
142 <p class="p-4 text-sm text-gray-500">No diff available</p>
143

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button