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.
Commit
7b1e2aaee15e8069cb7c53f756d6c6ba1fcc5aa78bb6ba01bc9b5b2a77c32857
Parent
2bded9fb6ce6ee6…
1 file changed
+9
-7
+9
-7
| --- src/fossil.diff.js | ||
| +++ src/fossil.diff.js | ||
| @@ -267,15 +267,13 @@ | ||
| 267 | 267 | let btnUp = false, btnDown = false; |
| 268 | 268 | /** |
| 269 | 269 | this.pos.next refers to the line numbers in the next TR's chunk. |
| 270 | 270 | this.pos.prev refers to the line numbers in the previous TR's chunk. |
| 271 | 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))){ | |
| 272 | + if(this.pos.prev && this.pos.next | |
| 273 | + && ((this.pos.next.startLhs - this.pos.prev.endLhs) | |
| 274 | + <= Diff.config.chunkLoadLines)){ | |
| 277 | 275 | /* Place a single button to load the whole block, rather |
| 278 | 276 | than separate up/down buttons. */ |
| 279 | 277 | btnDown = false; |
| 280 | 278 | btnUp = this.createButton(this.FetchType.FillGap); |
| 281 | 279 | }else{ |
| @@ -372,13 +370,17 @@ | ||
| 372 | 370 | |
| 373 | 371 | /** |
| 374 | 372 | If the gap between this.pos.endLhs/startLhs is less than or equal to |
| 375 | 373 | Diff.config.chunkLoadLines then this function replaces any up/down buttons |
| 376 | 374 | 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 | + */ | |
| 378 | 379 | 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)){ | |
| 380 | 382 | D.clearElement(this.e.btnWrapper); |
| 381 | 383 | D.append(this.e.btnWrapper, this.createButton(this.FetchType.FillGap)); |
| 382 | 384 | } |
| 383 | 385 | return this; |
| 384 | 386 | }, |
| 385 | 387 |
| --- 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 |