Fossil SCM

Worked around, rather accidentally, the Darkmode and Xekri skin weirdness - side effects of padding. Bootstrap is still a bit funky, depending at least partially on which media query is currently active.

stephan 2021-09-11 07:36 diff-js-refactoring
Commit 3480785e39431ec9b69f88463eb8310be32e60439b13b0b42081095c2b4d3079
--- src/default.css
+++ src/default.css
@@ -537,17 +537,31 @@
537537
width: 100%;
538538
border-spacing: 0;
539539
border: 1px solid black;
540540
}
541541
table.diff td.diffln{
542
+ padding: 0;
543
+}
544
+table.diff td.diffln > pre{
542545
padding: 0 0.25em 0 0.5em;
546
+ margin: 0;
543547
}
544548
table.diff td {
545549
vertical-align: top;
550
+ padding: 0;
551
+ overflow: hidden /*work around inner PRE slight overflow/overlap*/;
546552
}
547553
table.diff pre {
548554
margin: 0 0 0 0;
555
+ padding: 0 0.5em;
556
+}
557
+table.diff td.diffln > pre {
558
+ padding: 0 0.35em 0 0.5em;
559
+}
560
+table.diff td.difftxt > pre {
561
+ min-width: 100%;
562
+ max-width: 100%;
549563
}
550564
tr.diffskip.jchunk {
551565
/* jchunk gets added from JS to diffskip rows when they are
552566
plugged into the /jchunk route. */
553567
background-color: aliceblue;
554568
--- src/default.css
+++ src/default.css
@@ -537,17 +537,31 @@
537 width: 100%;
538 border-spacing: 0;
539 border: 1px solid black;
540 }
541 table.diff td.diffln{
 
 
 
542 padding: 0 0.25em 0 0.5em;
 
543 }
544 table.diff td {
545 vertical-align: top;
 
 
546 }
547 table.diff pre {
548 margin: 0 0 0 0;
 
 
 
 
 
 
 
 
549 }
550 tr.diffskip.jchunk {
551 /* jchunk gets added from JS to diffskip rows when they are
552 plugged into the /jchunk route. */
553 background-color: aliceblue;
554
--- src/default.css
+++ src/default.css
@@ -537,17 +537,31 @@
537 width: 100%;
538 border-spacing: 0;
539 border: 1px solid black;
540 }
541 table.diff td.diffln{
542 padding: 0;
543 }
544 table.diff td.diffln > pre{
545 padding: 0 0.25em 0 0.5em;
546 margin: 0;
547 }
548 table.diff td {
549 vertical-align: top;
550 padding: 0;
551 overflow: hidden /*work around inner PRE slight overflow/overlap*/;
552 }
553 table.diff pre {
554 margin: 0 0 0 0;
555 padding: 0 0.5em;
556 }
557 table.diff td.diffln > pre {
558 padding: 0 0.35em 0 0.5em;
559 }
560 table.diff td.difftxt > pre {
561 min-width: 100%;
562 max-width: 100%;
563 }
564 tr.diffskip.jchunk {
565 /* jchunk gets added from JS to diffskip rows when they are
566 plugged into the /jchunk route. */
567 background-color: aliceblue;
568
+19 -13
--- src/fossil.diff.js
+++ src/fossil.diff.js
@@ -689,23 +689,25 @@
689689
}
690690
f.colsR.forEach(function(e){
691691
e.style.width = w + "px";
692692
e.style.maxWidth = w + "px";
693693
});
694
- if(!f.allDiffs){
695
- f.allDiffs = document.querySelectorAll('table.diff');
696
- }
697
- w = lastWidth;
698
- f.allDiffs.forEach(function f(e){
699
- if(!f.$){
700
- f.$ = e.getClientRects()[0];
701
- console.debug("diff table w =",w," f.$x",f.$);
702
- w - 2*f.$.x /* left margin (assume right==left, for simplicity) */;
703
- }
704
- e.style.maxWidth = w + "px";
705
- });
706
- //console.debug("checkTableWidth(",force,") lastWidth =",lastWidth);
694
+ if(0){ // seems to be unnecessary
695
+ if(!f.allDiffs){
696
+ f.allDiffs = document.querySelectorAll('table.diff');
697
+ }
698
+ w = lastWidth;
699
+ f.allDiffs.forEach(function f(e){
700
+ if(0 && !f.$){
701
+ f.$ = e.getClientRects()[0];
702
+ console.debug("diff table w =",w," f.$x",f.$);
703
+ w - 2*f.$.x /* left margin (assume right==left, for simplicity) */;
704
+ }
705
+ e.style.maxWidth = w + "px";
706
+ });
707
+ //console.debug("checkTableWidth(",force,") lastWidth =",lastWidth);
708
+ }
707709
return this;
708710
};
709711
710712
const scrollLeft = function(event){
711713
//console.debug("scrollLeft",this,event);
@@ -744,10 +746,14 @@
744746
diff.addEventListener('keydown', function(e){
745747
e = e || event;
746748
const len = {37: -SCROLL_LEN, 39: SCROLL_LEN}[e.keyCode];
747749
if( !len ) return;
748750
this.$txtPres[0].scrollLeft += len;
751
+ /* ^^^ bug: if there is a 2nd column and it has a scrollbar
752
+ but txtPres[0] does not, no scrolling happens here. We need
753
+ to find the widest of txtPres and scroll that one. Example:
754
+ Checkin a7fbefee38a1c522 file diff.c */
749755
return false;
750756
}, false);
751757
}
752758
return this;
753759
}
754760
--- src/fossil.diff.js
+++ src/fossil.diff.js
@@ -689,23 +689,25 @@
689 }
690 f.colsR.forEach(function(e){
691 e.style.width = w + "px";
692 e.style.maxWidth = w + "px";
693 });
694 if(!f.allDiffs){
695 f.allDiffs = document.querySelectorAll('table.diff');
696 }
697 w = lastWidth;
698 f.allDiffs.forEach(function f(e){
699 if(!f.$){
700 f.$ = e.getClientRects()[0];
701 console.debug("diff table w =",w," f.$x",f.$);
702 w - 2*f.$.x /* left margin (assume right==left, for simplicity) */;
703 }
704 e.style.maxWidth = w + "px";
705 });
706 //console.debug("checkTableWidth(",force,") lastWidth =",lastWidth);
 
 
707 return this;
708 };
709
710 const scrollLeft = function(event){
711 //console.debug("scrollLeft",this,event);
@@ -744,10 +746,14 @@
744 diff.addEventListener('keydown', function(e){
745 e = e || event;
746 const len = {37: -SCROLL_LEN, 39: SCROLL_LEN}[e.keyCode];
747 if( !len ) return;
748 this.$txtPres[0].scrollLeft += len;
 
 
 
 
749 return false;
750 }, false);
751 }
752 return this;
753 }
754
--- src/fossil.diff.js
+++ src/fossil.diff.js
@@ -689,23 +689,25 @@
689 }
690 f.colsR.forEach(function(e){
691 e.style.width = w + "px";
692 e.style.maxWidth = w + "px";
693 });
694 if(0){ // seems to be unnecessary
695 if(!f.allDiffs){
696 f.allDiffs = document.querySelectorAll('table.diff');
697 }
698 w = lastWidth;
699 f.allDiffs.forEach(function f(e){
700 if(0 && !f.$){
701 f.$ = e.getClientRects()[0];
702 console.debug("diff table w =",w," f.$x",f.$);
703 w - 2*f.$.x /* left margin (assume right==left, for simplicity) */;
704 }
705 e.style.maxWidth = w + "px";
706 });
707 //console.debug("checkTableWidth(",force,") lastWidth =",lastWidth);
708 }
709 return this;
710 };
711
712 const scrollLeft = function(event){
713 //console.debug("scrollLeft",this,event);
@@ -744,10 +746,14 @@
746 diff.addEventListener('keydown', function(e){
747 e = e || event;
748 const len = {37: -SCROLL_LEN, 39: SCROLL_LEN}[e.keyCode];
749 if( !len ) return;
750 this.$txtPres[0].scrollLeft += len;
751 /* ^^^ bug: if there is a 2nd column and it has a scrollbar
752 but txtPres[0] does not, no scrolling happens here. We need
753 to find the widest of txtPres and scroll that one. Example:
754 Checkin a7fbefee38a1c522 file diff.c */
755 return false;
756 }, false);
757 }
758 return this;
759 }
760

Keyboard Shortcuts

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