Index: src/info.c ================================================================== --- src/info.c +++ src/info.c @@ -1701,35 +1701,62 @@ ** file. This routine appends that text to the HTTP reply with line numbering. ** ** zLn is the ?ln= parameter for the HTTP query. If there is an argument, ** then highlight that line number and scroll to it once the page loads. ** If there are two line numbers, highlight the range of lines. +** Multiple ranges can be highlighed by adding additional line numbers +** separated by a non-digit character (also not one of [-,.]). */ void output_text_with_line_numbers( const char *z, const char *zLn ){ int iStart, iEnd; /* Start and end of region to highlight */ int n = 0; /* Current line number */ - int i; /* Loop index */ + int i = 0; /* Loop index */ int iTop = 0; /* Scroll so that this line is on top of screen. */ + Stmt q; iStart = iEnd = atoi(zLn); + db_multi_exec( + "CREATE TEMP TABLE lnos(iStart INTEGER PRIMARY KEY, iEnd INTEGER)"); if( iStart>0 ){ - for(i=0; fossil_isdigit(zLn[i]); i++){} - if( zLn[i]==',' || zLn[i]=='-' || zLn[i]=='.' ){ - i++; - while( zLn[i]=='.' ){ i++; } - iEnd = atoi(&zLn[i]); - } - if( iEndiStart - 2 ) iTop = iStart-2; } + db_finalize(&q); @
   while( z[0] ){
     n++;
+    db_prepare(&q,
+      "SELECT min(iStart), max(iEnd) FROM lnos"
+      " WHERE iStart <= %d AND iEnd >= %d", n, n);
+    if( db_step(&q)==SQLITE_ROW ){
+      iStart = db_column_int(&q, 0);
+      iEnd = db_column_int(&q, 1);
+    }
+    db_finalize(&q);
     for(i=0; z[i] && z[i]!='\n'; i++){}
     if( n==iTop ) cgi_append_content("", -1);
     if( n==iStart ){
       cgi_append_content("
",-1); } @@ -1745,11 +1772,11 @@ z += i; if( z[0]=='\n' ) z++; } if( n"); @
- if( iStart ){ + if( db_int(0, "SELECT EXISTS(SELECT 1 FROM lnos)") ){ @ } } @@ -1764,10 +1791,11 @@ ** Additional query parameters: ** ** ln - show line numbers ** ln=N - highlight line number N ** ln=M-N - highlight lines M through N inclusive +** ln=M-N+Y-Z - higllight lines M through N and Y through Z (inclusive) ** verbose - show more detail in the description ** ** The /artifact page show the complete content of a file ** identified by SHA1HASH as preformatted text. The ** /whatis page shows only a description of the file.