Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 3 May 2003 11:27:01 -0400
From:      Roy Smith <roy@panix.com>
To:        Khachaturov Vassilii <Vassilii.Khachaturov@comverse.com>
Cc:        freebsd-cvsweb@freebsd.org
Subject:   Re: Displaying line numbers
Message-ID:  <AFE18A6B-7D7B-11D7-A92A-0050E405C35A@panix.com>
In-Reply-To: <6B1DF6EEBA51D31182F200902740436803B24F59@mail-in.comverse.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thursday, May 1, 2003, at 01:08  PM, Khachaturov Vassilii wrote:
>> In addition to the line numbers, there should be a <a
>> name="lXX">XX</a>
>> for all lines so that one can point to them using #lXX in URLs.  Even

Well, I finally sat down and looked at the code.  Turns out this is a 
fairly trivial change, at least for a simple version.  Diffs from the 
2.0.6  cvsweb.cgi (the line numbers may be off a little; I left out 
some other, non-related changes).


*** 1943,1952 ****
         } else {
                 print "<pre>";

-               my $lineNumber = 0;
                 while (<$filehandle>) {
-                       $lineNumber++;
-                       printf '<i><a name="l%d">%5d:</a></i>  ', 
$lineNumber, $lineNumber;
                         print htmlquote($_);
                 }
                 print "</pre>";
--- 1941,1947 ----

I didn't worry much about figuring out how many lines the file had.  I 
left room for 5-digit line numbers, which seemed good enough.

I guess the next thing would be to add some way to turn the feature on 
and off.  I could see two ways.  One would be a static switch in 
cvsweb.conf, the other would be some sort of control on the "CVS log 
for xxx" page.  Maybe instead of:

Revision 1.1 / (download) - annotate - [select for diffs]

there could be an additional link:

Revision 1.1 (with/without line numbers) / (download) - annotate - 
[select for diffs],

or a checkbox.  Maybe the static switch in cvsweb.conf would control 
the default setting of the checkbox (i.e. by default you get line 
numbers vs. by default you don't).

Any ideas?

Left to my own devices, I'm inclined to go with the idea of a checkbox 
and a cvsweb.conf switch to control the default value.





Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?AFE18A6B-7D7B-11D7-A92A-0050E405C35A>