Highlighting lines or line ranges in tree view

Andy Green andy at warmcat.com
Wed Jun 20 11:39:53 CEST 2018

Hi -

It's convenient to be able to provide a URL that points to a specific 
line in tree view.  cgit provides links on the line numbers it produces 
to facilitate that, eg


However when you get there, there is no visual indication about the 
specific line.  If the line happens to be early enough in the file that 
the end of the file is not in view, then the line is vertically arranged 
by the browser to be the first visible line.  But if not, at least in 
firefox the vertical position is arranged so the last line of the file 
appears at the bottom and the first visible line is whatever it happens 
to be then, unrelated to the target in the URL.

I guess with some JS and planning, it would be possible to have the page 
parse the raw URL and highlight the matching lines, also ranges of lines 
from URLs like ...#n43-48

But I think today, there's no JS in cgit.  What's the feeling about this 
kind of enhancement?  Stuff will be no worse than it is now if JS is 
disabled on the client.  If JS in cgit is not verboten, what 
considerations should we think about from maintainability, security 
standpoints when integrating it?


More information about the CGit mailing list