Fossil SCM

Improve scroll width calculation for unified diffs.

florian 2023-01-21 10:50 trunk merge
Commit 7a76111fe0b758c4604255ca5d71abc07d1a63ade60256756628a51b0c145253
1 file changed +3 -1
--- src/fossil.diff.js
+++ src/fossil.diff.js
@@ -669,12 +669,14 @@
669669
e.style.maxWidth = w + "px";
670670
});
671671
if(force || !f.colsU){
672672
f.colsU = document.querySelectorAll('td.difftxtu pre');
673673
}
674
- w = lastWidth - 100;
675674
f.colsU.forEach(function(e){
675
+ w = lastWidth - 3; // Outer border
676
+ var k = e.parentElement/*TD*/;
677
+ while(k = k.previousElementSibling/*TD*/) w -= k.scrollWidth;
676678
e.style.width = w + "px";
677679
e.style.maxWidth = w + "px";
678680
});
679681
if(0){ // seems to be unnecessary
680682
if(!f.allDiffs){
681683
--- src/fossil.diff.js
+++ src/fossil.diff.js
@@ -669,12 +669,14 @@
669 e.style.maxWidth = w + "px";
670 });
671 if(force || !f.colsU){
672 f.colsU = document.querySelectorAll('td.difftxtu pre');
673 }
674 w = lastWidth - 100;
675 f.colsU.forEach(function(e){
 
 
 
676 e.style.width = w + "px";
677 e.style.maxWidth = w + "px";
678 });
679 if(0){ // seems to be unnecessary
680 if(!f.allDiffs){
681
--- src/fossil.diff.js
+++ src/fossil.diff.js
@@ -669,12 +669,14 @@
669 e.style.maxWidth = w + "px";
670 });
671 if(force || !f.colsU){
672 f.colsU = document.querySelectorAll('td.difftxtu pre');
673 }
 
674 f.colsU.forEach(function(e){
675 w = lastWidth - 3; // Outer border
676 var k = e.parentElement/*TD*/;
677 while(k = k.previousElementSibling/*TD*/) w -= k.scrollWidth;
678 e.style.width = w + "px";
679 e.style.maxWidth = w + "px";
680 });
681 if(0){ // seems to be unnecessary
682 if(!f.allDiffs){
683

Keyboard Shortcuts

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