Fossil SCM

Reimplemented ln=... highlighting to mark the line numbers instead of the code, so that there is no interference with syntax highlighters. Adjusted two skins to use the newer line-marking CSS.

stephan 2020-08-15 03:51 line-number-selection
Commit 14ac3e8469f392eb917e3fd79b0863ac21ee81688b965e455ff03b70a95e09e1
--- skins/eagle/css.txt
+++ skins/eagle/css.txt
@@ -399,11 +399,11 @@
399399
400400
div.filetreeline:hover {
401401
background-color: #7EA2D9;
402402
}
403403
404
-div.selectedText {
404
+table.numbered-lines td.line-numbers span.selected-line {
405405
background-color: #7EA2D9;
406406
}
407407
408408
.statistics-report-graph-line {
409409
background-color: #7EA2D9;
410410
--- skins/eagle/css.txt
+++ skins/eagle/css.txt
@@ -399,11 +399,11 @@
399
400 div.filetreeline:hover {
401 background-color: #7EA2D9;
402 }
403
404 div.selectedText {
405 background-color: #7EA2D9;
406 }
407
408 .statistics-report-graph-line {
409 background-color: #7EA2D9;
410
--- skins/eagle/css.txt
+++ skins/eagle/css.txt
@@ -399,11 +399,11 @@
399
400 div.filetreeline:hover {
401 background-color: #7EA2D9;
402 }
403
404 table.numbered-lines td.line-numbers span.selected-line {
405 background-color: #7EA2D9;
406 }
407
408 .statistics-report-graph-line {
409 background-color: #7EA2D9;
410
--- skins/xekri/css.txt
+++ skins/xekri/css.txt
@@ -1000,15 +1000,15 @@
10001000
/**************************************
10011001
* Did not encounter these
10021002
*/
10031003
10041004
/* selected lines of text within a linenumbered artifact display */
1005
-div.selectedText {
1005
+table.numbered-lines td.line-numbers span.selected-line {
10061006
font-weight: bold;
10071007
color: #00f;
10081008
background-color: #d5d5ff;
1009
- border: 1px #00f solid;
1009
+ border-color: #00f;
10101010
}
10111011
10121012
/* format for missing privileges note on user setup page */
10131013
p.missingPriv {
10141014
color: #00f;
10151015
--- skins/xekri/css.txt
+++ skins/xekri/css.txt
@@ -1000,15 +1000,15 @@
1000 /**************************************
1001 * Did not encounter these
1002 */
1003
1004 /* selected lines of text within a linenumbered artifact display */
1005 div.selectedText {
1006 font-weight: bold;
1007 color: #00f;
1008 background-color: #d5d5ff;
1009 border: 1px #00f solid;
1010 }
1011
1012 /* format for missing privileges note on user setup page */
1013 p.missingPriv {
1014 color: #00f;
1015
--- skins/xekri/css.txt
+++ skins/xekri/css.txt
@@ -1000,15 +1000,15 @@
1000 /**************************************
1001 * Did not encounter these
1002 */
1003
1004 /* selected lines of text within a linenumbered artifact display */
1005 table.numbered-lines td.line-numbers span.selected-line {
1006 font-weight: bold;
1007 color: #00f;
1008 background-color: #d5d5ff;
1009 border-color: #00f;
1010 }
1011
1012 /* format for missing privileges note on user setup page */
1013 p.missingPriv {
1014 color: #00f;
1015
+25 -19
--- src/default.css
+++ src/default.css
@@ -440,18 +440,10 @@
440440
content:"'";
441441
}
442442
span.usertype:after {
443443
content:"'";
444444
}
445
-div.selectedText {
446
- font-weight: bold;
447
- color: blue;
448
- background-color: #d5d5ff;
449
- border: 1px blue solid;
450
- border-top: none;
451
- border-bottom: none;
452
-}
453445
p.missingPriv {
454446
color: blue;
455447
}
456448
span.wikiruleHead {
457449
font-weight: bold;
@@ -1170,45 +1162,59 @@
11701162
margin: 0;
11711163
white-space: nowrap;
11721164
vertical-align: top;
11731165
padding: 1em 0 0 0 /*prevents slight overlap at top */;
11741166
}
1175
-table.numbered-lines td:nth-of-type(1) > span {
1167
+table.numbered-lines td.line-numbers > span {
11761168
display: block;
11771169
margin: 0;
11781170
padding: 0;
11791171
line-height: inherit;
11801172
font-size: inherit;
11811173
font-family: inherit;
11821174
cursor: pointer;
11831175
white-space: pre;
11841176
}
1185
-table.numbered-lines td:nth-of-type(1) > span:hover {
1177
+table.numbered-lines td.line-numbers > span:hover {
11861178
background-color: #777;
11871179
opacity: 0.25;
11881180
}
1189
-table.numbered-lines td:nth-of-type(2) {
1181
+table.numbered-lines td.file-content {
11901182
padding-left: 1em;
11911183
}
1192
-table.numbered-lines td:nth-of-type(2) > pre {
1184
+table.numbered-lines td.file-content > pre {
11931185
margin: 0;
11941186
padding: 0;
11951187
overflow-x: auto;
11961188
overflow-y: hidden /* apparently not needed, but eases my mind */;
11971189
padding: 0 0 1em 0 /*prevents a slight underlap at bottom from triggering a scrollar */;
11981190
}
1199
-table.numbered-lines td:nth-of-type(2) > pre > code {
1191
+table.numbered-lines td.file-content > pre > code {
12001192
margin: 0;
12011193
padding: 0;
12021194
white-space: pre;
12031195
line-height: inherit;
12041196
font-size: inherit;
12051197
font-family: inherit;
12061198
}
1207
-table.numbered-lines td:nth-of-type(2) > pre > code > * {
1199
+table.numbered-lines td.file-content > pre > code > * {
12081200
box-sizing: border-box;
12091201
}
1210
-/* if div.selectedText has a top/bottom border, we need to subtract those
1211
- from the top margin here... */
1212
-/*table.numbered-lines td:nth-of-type(2) > pre > code > div.selectedText {
1213
- margin-top: -2px;
1214
-}*/
1202
+div.selectedText/*legacy*/,
1203
+table.numbered-lines td.line-numbers span.selected-line/*replacement*/ {
1204
+ font-weight: bold;
1205
+ color: blue;
1206
+ background-color: #d5d5ff;
1207
+ border: 1px blue solid;
1208
+ border-top-width: 0;
1209
+ border-bottom-width: 0;
1210
+ padding: 0;
1211
+ margin: 0;
1212
+}
1213
+table.numbered-lines td.line-numbers span.selected-line.start {
1214
+ border-top-width: 1px;
1215
+ margin-top: -1px/*restore alignment*/;
1216
+}
1217
+table.numbered-lines td.line-numbers span.selected-line.end {
1218
+ border-bottom-width: 1px;
1219
+ margin-top: -1px/*restore alignment*/;
1220
+}
12151221
--- src/default.css
+++ src/default.css
@@ -440,18 +440,10 @@
440 content:"'";
441 }
442 span.usertype:after {
443 content:"'";
444 }
445 div.selectedText {
446 font-weight: bold;
447 color: blue;
448 background-color: #d5d5ff;
449 border: 1px blue solid;
450 border-top: none;
451 border-bottom: none;
452 }
453 p.missingPriv {
454 color: blue;
455 }
456 span.wikiruleHead {
457 font-weight: bold;
@@ -1170,45 +1162,59 @@
1170 margin: 0;
1171 white-space: nowrap;
1172 vertical-align: top;
1173 padding: 1em 0 0 0 /*prevents slight overlap at top */;
1174 }
1175 table.numbered-lines td:nth-of-type(1) > span {
1176 display: block;
1177 margin: 0;
1178 padding: 0;
1179 line-height: inherit;
1180 font-size: inherit;
1181 font-family: inherit;
1182 cursor: pointer;
1183 white-space: pre;
1184 }
1185 table.numbered-lines td:nth-of-type(1) > span:hover {
1186 background-color: #777;
1187 opacity: 0.25;
1188 }
1189 table.numbered-lines td:nth-of-type(2) {
1190 padding-left: 1em;
1191 }
1192 table.numbered-lines td:nth-of-type(2) > pre {
1193 margin: 0;
1194 padding: 0;
1195 overflow-x: auto;
1196 overflow-y: hidden /* apparently not needed, but eases my mind */;
1197 padding: 0 0 1em 0 /*prevents a slight underlap at bottom from triggering a scrollar */;
1198 }
1199 table.numbered-lines td:nth-of-type(2) > pre > code {
1200 margin: 0;
1201 padding: 0;
1202 white-space: pre;
1203 line-height: inherit;
1204 font-size: inherit;
1205 font-family: inherit;
1206 }
1207 table.numbered-lines td:nth-of-type(2) > pre > code > * {
1208 box-sizing: border-box;
1209 }
1210 /* if div.selectedText has a top/bottom border, we need to subtract those
1211 from the top margin here... */
1212 /*table.numbered-lines td:nth-of-type(2) > pre > code > div.selectedText {
1213 margin-top: -2px;
1214 }*/
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1215
--- src/default.css
+++ src/default.css
@@ -440,18 +440,10 @@
440 content:"'";
441 }
442 span.usertype:after {
443 content:"'";
444 }
 
 
 
 
 
 
 
 
445 p.missingPriv {
446 color: blue;
447 }
448 span.wikiruleHead {
449 font-weight: bold;
@@ -1170,45 +1162,59 @@
1162 margin: 0;
1163 white-space: nowrap;
1164 vertical-align: top;
1165 padding: 1em 0 0 0 /*prevents slight overlap at top */;
1166 }
1167 table.numbered-lines td.line-numbers > span {
1168 display: block;
1169 margin: 0;
1170 padding: 0;
1171 line-height: inherit;
1172 font-size: inherit;
1173 font-family: inherit;
1174 cursor: pointer;
1175 white-space: pre;
1176 }
1177 table.numbered-lines td.line-numbers > span:hover {
1178 background-color: #777;
1179 opacity: 0.25;
1180 }
1181 table.numbered-lines td.file-content {
1182 padding-left: 1em;
1183 }
1184 table.numbered-lines td.file-content > pre {
1185 margin: 0;
1186 padding: 0;
1187 overflow-x: auto;
1188 overflow-y: hidden /* apparently not needed, but eases my mind */;
1189 padding: 0 0 1em 0 /*prevents a slight underlap at bottom from triggering a scrollar */;
1190 }
1191 table.numbered-lines td.file-content > pre > code {
1192 margin: 0;
1193 padding: 0;
1194 white-space: pre;
1195 line-height: inherit;
1196 font-size: inherit;
1197 font-family: inherit;
1198 }
1199 table.numbered-lines td.file-content > pre > code > * {
1200 box-sizing: border-box;
1201 }
1202 div.selectedText/*legacy*/,
1203 table.numbered-lines td.line-numbers span.selected-line/*replacement*/ {
1204 font-weight: bold;
1205 color: blue;
1206 background-color: #d5d5ff;
1207 border: 1px blue solid;
1208 border-top-width: 0;
1209 border-bottom-width: 0;
1210 padding: 0;
1211 margin: 0;
1212 }
1213 table.numbered-lines td.line-numbers span.selected-line.start {
1214 border-top-width: 1px;
1215 margin-top: -1px/*restore alignment*/;
1216 }
1217 table.numbered-lines td.line-numbers span.selected-line.end {
1218 border-bottom-width: 1px;
1219 margin-top: -1px/*restore alignment*/;
1220 }
1221
+53 -45
--- src/info.c
+++ src/info.c
@@ -2017,11 +2017,11 @@
20172017
** code file and nZ is its length in bytes. This routine appends that
20182018
** text to the HTTP reply with line numbering.
20192019
**
20202020
** zName is the content's file name, if any (it may be NULL). If that
20212021
** name contains a '.' then the part after the final '.' is used as
2022
-** the X part of a "language-X" CSS class on the generate CODE block.
2022
+** the X part of a "language-X" CSS class on the generated CODE block.
20232023
**
20242024
** zLn is the ?ln= parameter for the HTTP query. If there is an argument,
20252025
** then highlight that line number and scroll to it once the page loads.
20262026
** If there are two line numbers, highlight the range of lines.
20272027
** Multiple ranges can be highlighed by adding additional line numbers
@@ -2035,11 +2035,12 @@
20352035
){
20362036
int iStart, iEnd; /* Start and end of region to highlight */
20372037
int n = 0; /* Current line number */
20382038
int i = 0; /* Loop index */
20392039
int iTop = 0; /* Scroll so that this line is on top of screen. */
2040
- int nLine = 0;
2040
+ int nLine = 0; /* content line count */
2041
+ int nSpans = 0; /* number of distinct zLn spans */
20412042
const char *zExt = file_extension(zName);
20422043
Stmt q;
20432044
20442045
iStart = iEnd = atoi(zLn);
20452046
db_multi_exec(
@@ -2056,60 +2057,67 @@
20562057
while( fossil_isdigit(zLn[i]) ) i++;
20572058
if( iEnd<iStart ) iEnd = iStart;
20582059
db_multi_exec(
20592060
"INSERT OR REPLACE INTO lnos VALUES(%d,%d)", iStart, iEnd
20602061
);
2062
+ ++nSpans;
20612063
iStart = iEnd = atoi(&zLn[i++]);
20622064
}while( zLn[i] && iStart && iEnd );
20632065
}
2064
- db_prepare(&q, "SELECT min(iStart), max(iEnd) FROM lnos");
2065
- if( db_step(&q)==SQLITE_ROW ){
2066
- iStart = db_column_int(&q, 0);
2067
- iEnd = db_column_int(&q, 1);
2068
- iTop = iStart - 15 + (iEnd-iStart)/4;
2069
- if( iTop>iStart - 2 ) iTop = iStart-2;
2070
- }
2071
- db_finalize(&q);
2072
- CX("<table class='numbered-lines'><tbody><tr><td>");
2066
+ /*cgi_printf("<!-- ln span count=%d -->", nSpans);*/
2067
+ cgi_append_content("<table class='numbered-lines'><tbody>"
2068
+ "<tr><td class='line-numbers'>", -1);
2069
+ iStart = iEnd = 0;
20732070
count_lines(z, nZ, &nLine);
2074
- for(i=0; i < nLine; ++i){
2075
- CX("<span>%6d</span>", i+1);
2071
+ for( n=1 ; n<=nLine; ++n ){
2072
+ const char * zAttr = "";
2073
+ const char * zId = "";
2074
+ if(nSpans>0 && iEnd==0){/*Grab the next range of zLn marking*/
2075
+ db_prepare(&q, "SELECT iStart, iEnd FROM lnos "
2076
+ "WHERE iStart >= %d ORDER BY iStart", n);
2077
+ if( db_step(&q)==SQLITE_ROW ){
2078
+ iStart = db_column_int(&q, 0);
2079
+ iEnd = db_column_int(&q, 1);
2080
+ if(!iTop){
2081
+ iTop = iStart - 15 + (iEnd-iStart)/4;
2082
+ if( iTop>iStart - 2 ) iTop = iStart-2;
2083
+ }
2084
+ }else{
2085
+ /* Note that overlapping multi-spans, e.g. 10-15+12-20,
2086
+ can cause us to miss a row. */
2087
+ iStart = iEnd = 0;
2088
+ }
2089
+ db_finalize(&q);
2090
+ --nSpans;
2091
+ /*cgi_printf("<!-- iStart=%d, iEnd=%d -->", iStart, iEnd);*/
2092
+ }
2093
+ if(n==iTop) {
2094
+ zId = " id='scrollToMe'";
2095
+ }
2096
+ if(n==iStart){/*Figure out which CSS class(es) this line needs...*/
2097
+ if(n==iEnd){
2098
+ zAttr = " class='selected-line start end'";
2099
+ iEnd = 0;
2100
+ }else{
2101
+ zAttr = " class='selected-line start'";
2102
+ }
2103
+ iStart = 0;
2104
+ }else if(n==iEnd){
2105
+ zAttr = " class='selected-line end'";
2106
+ iEnd = 0;
2107
+ }else if( n>iStart && n<iEnd ){
2108
+ zAttr = " class='selected-line'";
2109
+ }
2110
+ cgi_printf("<span%s%s>%6d</span>", zId, zAttr, n);
20762111
}
2077
- CX("</td><td><pre>");
2112
+ cgi_append_content("</td><td class='file-content'><pre>",-1);
20782113
if(zExt && *zExt){
2079
- CX("<code class='language-%h'>",zExt);
2114
+ cgi_printf("<code class='language-%h'>",zExt);
20802115
}else{
2081
- CX("<code>");
2082
- }
2083
- assert(!n);
2084
- while( z[0] ){
2085
- n++;
2086
- db_prepare(&q,
2087
- "SELECT min(iStart), max(iEnd) FROM lnos"
2088
- " WHERE iStart <= %d AND iEnd >= %d", n, n);
2089
- if( db_step(&q)==SQLITE_ROW ){
2090
- iStart = db_column_int(&q, 0);
2091
- iEnd = db_column_int(&q, 1);
2092
- }
2093
- db_finalize(&q);
2094
- for(i=0; z[i] && z[i]!='\n'; i++){}
2095
- if( n==iTop ) cgi_append_content("<span id=\"scrollToMe\">", -1);
2096
- if( n==iStart ){
2097
- cgi_append_content("<div class=\"selectedText\">",-1);
2098
- }
2099
- if( i>0 ){
2100
- char *zHtml = htmlize(z, i);
2101
- cgi_append_content(zHtml, -1);
2102
- fossil_free(zHtml);
2103
- }
2104
- if( n==iTop ) cgi_append_content("</span>", -1);
2105
- if( n==iEnd ) cgi_append_content("</div>", -1);
2106
- else cgi_append_content("\n", 1);
2107
- z += i;
2108
- if( z[0]=='\n' ) z++;
2109
- }
2110
- if( n<iEnd ) cgi_printf("</div>");
2116
+ cgi_append_content("<code>", -1);
2117
+ }
2118
+ cgi_printf("%.*h", nZ, z);
21112119
CX("</code></pre></td></tr></tbody></table>\n");
21122120
if( db_int(0, "SELECT EXISTS(SELECT 1 FROM lnos)") ){
21132121
builtin_request_js("scroll.js");
21142122
}
21152123
builtin_request_js("fossil.numbered-lines.js");
21162124
--- src/info.c
+++ src/info.c
@@ -2017,11 +2017,11 @@
2017 ** code file and nZ is its length in bytes. This routine appends that
2018 ** text to the HTTP reply with line numbering.
2019 **
2020 ** zName is the content's file name, if any (it may be NULL). If that
2021 ** name contains a '.' then the part after the final '.' is used as
2022 ** the X part of a "language-X" CSS class on the generate CODE block.
2023 **
2024 ** zLn is the ?ln= parameter for the HTTP query. If there is an argument,
2025 ** then highlight that line number and scroll to it once the page loads.
2026 ** If there are two line numbers, highlight the range of lines.
2027 ** Multiple ranges can be highlighed by adding additional line numbers
@@ -2035,11 +2035,12 @@
2035 ){
2036 int iStart, iEnd; /* Start and end of region to highlight */
2037 int n = 0; /* Current line number */
2038 int i = 0; /* Loop index */
2039 int iTop = 0; /* Scroll so that this line is on top of screen. */
2040 int nLine = 0;
 
2041 const char *zExt = file_extension(zName);
2042 Stmt q;
2043
2044 iStart = iEnd = atoi(zLn);
2045 db_multi_exec(
@@ -2056,60 +2057,67 @@
2056 while( fossil_isdigit(zLn[i]) ) i++;
2057 if( iEnd<iStart ) iEnd = iStart;
2058 db_multi_exec(
2059 "INSERT OR REPLACE INTO lnos VALUES(%d,%d)", iStart, iEnd
2060 );
 
2061 iStart = iEnd = atoi(&zLn[i++]);
2062 }while( zLn[i] && iStart && iEnd );
2063 }
2064 db_prepare(&q, "SELECT min(iStart), max(iEnd) FROM lnos");
2065 if( db_step(&q)==SQLITE_ROW ){
2066 iStart = db_column_int(&q, 0);
2067 iEnd = db_column_int(&q, 1);
2068 iTop = iStart - 15 + (iEnd-iStart)/4;
2069 if( iTop>iStart - 2 ) iTop = iStart-2;
2070 }
2071 db_finalize(&q);
2072 CX("<table class='numbered-lines'><tbody><tr><td>");
2073 count_lines(z, nZ, &nLine);
2074 for(i=0; i < nLine; ++i){
2075 CX("<span>%6d</span>", i+1);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2076 }
2077 CX("</td><td><pre>");
2078 if(zExt && *zExt){
2079 CX("<code class='language-%h'>",zExt);
2080 }else{
2081 CX("<code>");
2082 }
2083 assert(!n);
2084 while( z[0] ){
2085 n++;
2086 db_prepare(&q,
2087 "SELECT min(iStart), max(iEnd) FROM lnos"
2088 " WHERE iStart <= %d AND iEnd >= %d", n, n);
2089 if( db_step(&q)==SQLITE_ROW ){
2090 iStart = db_column_int(&q, 0);
2091 iEnd = db_column_int(&q, 1);
2092 }
2093 db_finalize(&q);
2094 for(i=0; z[i] && z[i]!='\n'; i++){}
2095 if( n==iTop ) cgi_append_content("<span id=\"scrollToMe\">", -1);
2096 if( n==iStart ){
2097 cgi_append_content("<div class=\"selectedText\">",-1);
2098 }
2099 if( i>0 ){
2100 char *zHtml = htmlize(z, i);
2101 cgi_append_content(zHtml, -1);
2102 fossil_free(zHtml);
2103 }
2104 if( n==iTop ) cgi_append_content("</span>", -1);
2105 if( n==iEnd ) cgi_append_content("</div>", -1);
2106 else cgi_append_content("\n", 1);
2107 z += i;
2108 if( z[0]=='\n' ) z++;
2109 }
2110 if( n<iEnd ) cgi_printf("</div>");
2111 CX("</code></pre></td></tr></tbody></table>\n");
2112 if( db_int(0, "SELECT EXISTS(SELECT 1 FROM lnos)") ){
2113 builtin_request_js("scroll.js");
2114 }
2115 builtin_request_js("fossil.numbered-lines.js");
2116
--- src/info.c
+++ src/info.c
@@ -2017,11 +2017,11 @@
2017 ** code file and nZ is its length in bytes. This routine appends that
2018 ** text to the HTTP reply with line numbering.
2019 **
2020 ** zName is the content's file name, if any (it may be NULL). If that
2021 ** name contains a '.' then the part after the final '.' is used as
2022 ** the X part of a "language-X" CSS class on the generated CODE block.
2023 **
2024 ** zLn is the ?ln= parameter for the HTTP query. If there is an argument,
2025 ** then highlight that line number and scroll to it once the page loads.
2026 ** If there are two line numbers, highlight the range of lines.
2027 ** Multiple ranges can be highlighed by adding additional line numbers
@@ -2035,11 +2035,12 @@
2035 ){
2036 int iStart, iEnd; /* Start and end of region to highlight */
2037 int n = 0; /* Current line number */
2038 int i = 0; /* Loop index */
2039 int iTop = 0; /* Scroll so that this line is on top of screen. */
2040 int nLine = 0; /* content line count */
2041 int nSpans = 0; /* number of distinct zLn spans */
2042 const char *zExt = file_extension(zName);
2043 Stmt q;
2044
2045 iStart = iEnd = atoi(zLn);
2046 db_multi_exec(
@@ -2056,60 +2057,67 @@
2057 while( fossil_isdigit(zLn[i]) ) i++;
2058 if( iEnd<iStart ) iEnd = iStart;
2059 db_multi_exec(
2060 "INSERT OR REPLACE INTO lnos VALUES(%d,%d)", iStart, iEnd
2061 );
2062 ++nSpans;
2063 iStart = iEnd = atoi(&zLn[i++]);
2064 }while( zLn[i] && iStart && iEnd );
2065 }
2066 /*cgi_printf("<!-- ln span count=%d -->", nSpans);*/
2067 cgi_append_content("<table class='numbered-lines'><tbody>"
2068 "<tr><td class='line-numbers'>", -1);
2069 iStart = iEnd = 0;
 
 
 
 
 
2070 count_lines(z, nZ, &nLine);
2071 for( n=1 ; n<=nLine; ++n ){
2072 const char * zAttr = "";
2073 const char * zId = "";
2074 if(nSpans>0 && iEnd==0){/*Grab the next range of zLn marking*/
2075 db_prepare(&q, "SELECT iStart, iEnd FROM lnos "
2076 "WHERE iStart >= %d ORDER BY iStart", n);
2077 if( db_step(&q)==SQLITE_ROW ){
2078 iStart = db_column_int(&q, 0);
2079 iEnd = db_column_int(&q, 1);
2080 if(!iTop){
2081 iTop = iStart - 15 + (iEnd-iStart)/4;
2082 if( iTop>iStart - 2 ) iTop = iStart-2;
2083 }
2084 }else{
2085 /* Note that overlapping multi-spans, e.g. 10-15+12-20,
2086 can cause us to miss a row. */
2087 iStart = iEnd = 0;
2088 }
2089 db_finalize(&q);
2090 --nSpans;
2091 /*cgi_printf("<!-- iStart=%d, iEnd=%d -->", iStart, iEnd);*/
2092 }
2093 if(n==iTop) {
2094 zId = " id='scrollToMe'";
2095 }
2096 if(n==iStart){/*Figure out which CSS class(es) this line needs...*/
2097 if(n==iEnd){
2098 zAttr = " class='selected-line start end'";
2099 iEnd = 0;
2100 }else{
2101 zAttr = " class='selected-line start'";
2102 }
2103 iStart = 0;
2104 }else if(n==iEnd){
2105 zAttr = " class='selected-line end'";
2106 iEnd = 0;
2107 }else if( n>iStart && n<iEnd ){
2108 zAttr = " class='selected-line'";
2109 }
2110 cgi_printf("<span%s%s>%6d</span>", zId, zAttr, n);
2111 }
2112 cgi_append_content("</td><td class='file-content'><pre>",-1);
2113 if(zExt && *zExt){
2114 cgi_printf("<code class='language-%h'>",zExt);
2115 }else{
2116 cgi_append_content("<code>", -1);
2117 }
2118 cgi_printf("%.*h", nZ, z);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2119 CX("</code></pre></td></tr></tbody></table>\n");
2120 if( db_int(0, "SELECT EXISTS(SELECT 1 FROM lnos)") ){
2121 builtin_request_js("scroll.js");
2122 }
2123 builtin_request_js("fossil.numbered-lines.js");
2124

Keyboard Shortcuts

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