Fossil SCM

diff context: never show the dual-mode up/down buttons at the very start or end of a file, only in the gaps between two chunks.

stephan 2021-09-11 17:44 trunk
Commit 7b1e2aaee15e8069cb7c53f756d6c6ba1fcc5aa78bb6ba01bc9b5b2a77c32857
1 file changed +9 -7
--- src/fossil.diff.js
+++ src/fossil.diff.js
@@ -267,15 +267,13 @@
267267
let btnUp = false, btnDown = false;
268268
/**
269269
this.pos.next refers to the line numbers in the next TR's chunk.
270270
this.pos.prev refers to the line numbers in the previous TR's chunk.
271271
*/
272
- if((this.pos.startLhs + Diff.config.chunkLoadLines
273
- >= this.pos.endLhs )
274
- || (this.pos.prev && this.pos.next
275
- && ((this.pos.next.startLhs - this.pos.prev.endLhs)
276
- <= Diff.config.chunkLoadLines))){
272
+ if(this.pos.prev && this.pos.next
273
+ && ((this.pos.next.startLhs - this.pos.prev.endLhs)
274
+ <= Diff.config.chunkLoadLines)){
277275
/* Place a single button to load the whole block, rather
278276
than separate up/down buttons. */
279277
btnDown = false;
280278
btnUp = this.createButton(this.FetchType.FillGap);
281279
}else{
@@ -372,13 +370,17 @@
372370
373371
/**
374372
If the gap between this.pos.endLhs/startLhs is less than or equal to
375373
Diff.config.chunkLoadLines then this function replaces any up/down buttons
376374
with a gap-filler button, else it's a no-op. Returns this object.
377
- */
375
+
376
+ As a special case, do not apply this at the start or bottom
377
+ of the diff, only between two diff chunks.
378
+ */
378379
maybeReplaceButtons: function(){
379
- if(this.pos.endLhs - this.pos.startLhs <= Diff.config.chunkLoadLines){
380
+ if(this.pos.next && this.pos.prev
381
+ && (this.pos.endLhs - this.pos.startLhs <= Diff.config.chunkLoadLines)){
380382
D.clearElement(this.e.btnWrapper);
381383
D.append(this.e.btnWrapper, this.createButton(this.FetchType.FillGap));
382384
}
383385
return this;
384386
},
385387
--- src/fossil.diff.js
+++ src/fossil.diff.js
@@ -267,15 +267,13 @@
267 let btnUp = false, btnDown = false;
268 /**
269 this.pos.next refers to the line numbers in the next TR's chunk.
270 this.pos.prev refers to the line numbers in the previous TR's chunk.
271 */
272 if((this.pos.startLhs + Diff.config.chunkLoadLines
273 >= this.pos.endLhs )
274 || (this.pos.prev && this.pos.next
275 && ((this.pos.next.startLhs - this.pos.prev.endLhs)
276 <= Diff.config.chunkLoadLines))){
277 /* Place a single button to load the whole block, rather
278 than separate up/down buttons. */
279 btnDown = false;
280 btnUp = this.createButton(this.FetchType.FillGap);
281 }else{
@@ -372,13 +370,17 @@
372
373 /**
374 If the gap between this.pos.endLhs/startLhs is less than or equal to
375 Diff.config.chunkLoadLines then this function replaces any up/down buttons
376 with a gap-filler button, else it's a no-op. Returns this object.
377 */
 
 
 
378 maybeReplaceButtons: function(){
379 if(this.pos.endLhs - this.pos.startLhs <= Diff.config.chunkLoadLines){
 
380 D.clearElement(this.e.btnWrapper);
381 D.append(this.e.btnWrapper, this.createButton(this.FetchType.FillGap));
382 }
383 return this;
384 },
385
--- src/fossil.diff.js
+++ src/fossil.diff.js
@@ -267,15 +267,13 @@
267 let btnUp = false, btnDown = false;
268 /**
269 this.pos.next refers to the line numbers in the next TR's chunk.
270 this.pos.prev refers to the line numbers in the previous TR's chunk.
271 */
272 if(this.pos.prev && this.pos.next
273 && ((this.pos.next.startLhs - this.pos.prev.endLhs)
274 <= Diff.config.chunkLoadLines)){
 
 
275 /* Place a single button to load the whole block, rather
276 than separate up/down buttons. */
277 btnDown = false;
278 btnUp = this.createButton(this.FetchType.FillGap);
279 }else{
@@ -372,13 +370,17 @@
370
371 /**
372 If the gap between this.pos.endLhs/startLhs is less than or equal to
373 Diff.config.chunkLoadLines then this function replaces any up/down buttons
374 with a gap-filler button, else it's a no-op. Returns this object.
375
376 As a special case, do not apply this at the start or bottom
377 of the diff, only between two diff chunks.
378 */
379 maybeReplaceButtons: function(){
380 if(this.pos.next && this.pos.prev
381 && (this.pos.endLhs - this.pos.startLhs <= Diff.config.chunkLoadLines)){
382 D.clearElement(this.e.btnWrapper);
383 D.append(this.e.btnWrapper, this.createButton(this.FetchType.FillGap));
384 }
385 return this;
386 },
387

Keyboard Shortcuts

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