Fossil SCM

Minor restructuring of the /file line number DOM elements to address text-mode browsers. [forum:c8fd094267a0f0d9| Forum post c8fd094267a0f0d9].

stephan 2021-09-23 04:46 trunk
Commit 53ff9d0de0ca79d0e58d8e75f26bb1bda42806a0d201df0a06f260085c596d67
2 files changed +7 -6 +4 -3
+7 -6
--- src/default.css
+++ src/default.css
@@ -1306,16 +1306,17 @@
13061306
padding: 0.25em 0 0 0 /*prevents slight overlap at top */;
13071307
}
13081308
table.numbered-lines td.line-numbers {
13091309
width: 4.5em;
13101310
}
1311
-table.numbered-lines td.line-numbers > span:first-of-type {
1312
- margin-top: 0.25em/*must match top PADDING of
1313
- td.file-content > pre > code*/;
1311
+table.numbered-lines td.line-numbers > pre {
1312
+ margin: 0.25em/*must match top PADDING of td.file-content
1313
+ > pre > code*/ 0 0 0;
1314
+ padding: 0;
13141315
}
1315
-table.numbered-lines td.line-numbers > span {
1316
- display: block;
1316
+table.numbered-lines td.line-numbers span {
1317
+ display: inline-block;
13171318
margin: 0;
13181319
padding: 0;
13191320
line-height: inherit;
13201321
font-size: inherit;
13211322
font-family: inherit;
@@ -1322,11 +1323,11 @@
13221323
cursor: pointer;
13231324
white-space: pre;
13241325
margin-right: 2px/*keep selection from nudging the right column */;
13251326
text-align: right;
13261327
}
1327
-table.numbered-lines td.line-numbers > span:hover {
1328
+table.numbered-lines td.line-numbers span:hover {
13281329
background-color: rgba(112, 112, 112, 0.25);
13291330
}
13301331
table.numbered-lines td.file-content {
13311332
padding-left: 0.25em;
13321333
}
13331334
--- src/default.css
+++ src/default.css
@@ -1306,16 +1306,17 @@
1306 padding: 0.25em 0 0 0 /*prevents slight overlap at top */;
1307 }
1308 table.numbered-lines td.line-numbers {
1309 width: 4.5em;
1310 }
1311 table.numbered-lines td.line-numbers > span:first-of-type {
1312 margin-top: 0.25em/*must match top PADDING of
1313 td.file-content > pre > code*/;
 
1314 }
1315 table.numbered-lines td.line-numbers > span {
1316 display: block;
1317 margin: 0;
1318 padding: 0;
1319 line-height: inherit;
1320 font-size: inherit;
1321 font-family: inherit;
@@ -1322,11 +1323,11 @@
1322 cursor: pointer;
1323 white-space: pre;
1324 margin-right: 2px/*keep selection from nudging the right column */;
1325 text-align: right;
1326 }
1327 table.numbered-lines td.line-numbers > span:hover {
1328 background-color: rgba(112, 112, 112, 0.25);
1329 }
1330 table.numbered-lines td.file-content {
1331 padding-left: 0.25em;
1332 }
1333
--- src/default.css
+++ src/default.css
@@ -1306,16 +1306,17 @@
1306 padding: 0.25em 0 0 0 /*prevents slight overlap at top */;
1307 }
1308 table.numbered-lines td.line-numbers {
1309 width: 4.5em;
1310 }
1311 table.numbered-lines td.line-numbers > pre {
1312 margin: 0.25em/*must match top PADDING of td.file-content
1313 > pre > code*/ 0 0 0;
1314 padding: 0;
1315 }
1316 table.numbered-lines td.line-numbers span {
1317 display: inline-block;
1318 margin: 0;
1319 padding: 0;
1320 line-height: inherit;
1321 font-size: inherit;
1322 font-family: inherit;
@@ -1322,11 +1323,11 @@
1323 cursor: pointer;
1324 white-space: pre;
1325 margin-right: 2px/*keep selection from nudging the right column */;
1326 text-align: right;
1327 }
1328 table.numbered-lines td.line-numbers span:hover {
1329 background-color: rgba(112, 112, 112, 0.25);
1330 }
1331 table.numbered-lines td.file-content {
1332 padding-left: 0.25em;
1333 }
1334
+4 -3
--- src/info.c
+++ src/info.c
@@ -2248,11 +2248,11 @@
22482248
iStart = iEnd = atoi(&zLn[i++]);
22492249
}while( zLn[i] && iStart && iEnd );
22502250
}
22512251
/*cgi_printf("<!-- ln span count=%d -->", nSpans);*/
22522252
cgi_append_content("<table class='numbered-lines'><tbody>"
2253
- "<tr><td class='line-numbers'>", -1);
2253
+ "<tr><td class='line-numbers'><pre>", -1);
22542254
iStart = iEnd = 0;
22552255
count_lines(z, nZ, &nLine);
22562256
for( n=1 ; n<=nLine; ++n ){
22572257
const char * zAttr = "";
22582258
const char * zId = "";
@@ -2290,13 +2290,14 @@
22902290
zAttr = " class='selected-line end'";
22912291
iEnd = 0;
22922292
}else if( n>iStart && n<iEnd ){
22932293
zAttr = " class='selected-line'";
22942294
}
2295
- cgi_printf("<span%s%s>%6d</span>", zId, zAttr, n);
2295
+ cgi_printf("<span%s%s>%6d</span>\n", zId, zAttr, n)
2296
+ /* ^^^ explicit \n is necessary for text-mode browsers. */;
22962297
}
2297
- cgi_append_content("</td><td class='file-content'><pre>",-1);
2298
+ cgi_append_content("</pre></td><td class='file-content'><pre>",-1);
22982299
if(zExt && *zExt){
22992300
cgi_printf("<code class='language-%h'>",zExt);
23002301
}else{
23012302
cgi_append_content("<code>", -1);
23022303
}
23032304
--- src/info.c
+++ src/info.c
@@ -2248,11 +2248,11 @@
2248 iStart = iEnd = atoi(&zLn[i++]);
2249 }while( zLn[i] && iStart && iEnd );
2250 }
2251 /*cgi_printf("<!-- ln span count=%d -->", nSpans);*/
2252 cgi_append_content("<table class='numbered-lines'><tbody>"
2253 "<tr><td class='line-numbers'>", -1);
2254 iStart = iEnd = 0;
2255 count_lines(z, nZ, &nLine);
2256 for( n=1 ; n<=nLine; ++n ){
2257 const char * zAttr = "";
2258 const char * zId = "";
@@ -2290,13 +2290,14 @@
2290 zAttr = " class='selected-line end'";
2291 iEnd = 0;
2292 }else if( n>iStart && n<iEnd ){
2293 zAttr = " class='selected-line'";
2294 }
2295 cgi_printf("<span%s%s>%6d</span>", zId, zAttr, n);
 
2296 }
2297 cgi_append_content("</td><td class='file-content'><pre>",-1);
2298 if(zExt && *zExt){
2299 cgi_printf("<code class='language-%h'>",zExt);
2300 }else{
2301 cgi_append_content("<code>", -1);
2302 }
2303
--- src/info.c
+++ src/info.c
@@ -2248,11 +2248,11 @@
2248 iStart = iEnd = atoi(&zLn[i++]);
2249 }while( zLn[i] && iStart && iEnd );
2250 }
2251 /*cgi_printf("<!-- ln span count=%d -->", nSpans);*/
2252 cgi_append_content("<table class='numbered-lines'><tbody>"
2253 "<tr><td class='line-numbers'><pre>", -1);
2254 iStart = iEnd = 0;
2255 count_lines(z, nZ, &nLine);
2256 for( n=1 ; n<=nLine; ++n ){
2257 const char * zAttr = "";
2258 const char * zId = "";
@@ -2290,13 +2290,14 @@
2290 zAttr = " class='selected-line end'";
2291 iEnd = 0;
2292 }else if( n>iStart && n<iEnd ){
2293 zAttr = " class='selected-line'";
2294 }
2295 cgi_printf("<span%s%s>%6d</span>\n", zId, zAttr, n)
2296 /* ^^^ explicit \n is necessary for text-mode browsers. */;
2297 }
2298 cgi_append_content("</pre></td><td class='file-content'><pre>",-1);
2299 if(zExt && *zExt){
2300 cgi_printf("<code class='language-%h'>",zExt);
2301 }else{
2302 cgi_append_content("<code>", -1);
2303 }
2304

Keyboard Shortcuts

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