[PATCH] Allow C&P from file revision in hgweb without also copying line numbers

Matt Mackall mpm at selenic.com
Tue Oct 11 12:41:53 CDT 2011

On Tue, 2011-10-11 at 12:37 -0500, Jordi Gutiérrez Hermoso wrote:
> 2011/10/11 Matt Mackall <mpm at selenic.com>:
> > On Tue, 2011-10-11 at 11:15 -0500, Jordi Gutiérrez Hermoso wrote:
> >> It's useful from the web interface to be able to highlight code in
> >> order to copy and paste it elsewhere. Unfortunately with the
> >> current web interface, this has the annoying result of also
> >> including the line numbers, so the pasted code will have them too
> >> and requires further surgery to work.
> >>
> >> This patch puts the line numbers for file revisions in a separate
> >> <td> inside a table, and the actual code in another <td>, so there
> >> are only two <td>s in the table. This is also done by passing the
> >> line numbers to the template in a separate generator object than
> >> the actual line contents themselves.
> >
> > What browsers did you test this against?
> Firefox and Chrome. Slightly old versions of both (debian stable).
> > I'm surprised this doesn't have any CSS hacks to deal with the
> > smaller font size used for line numbers.
> The font sizes don't matter. What matter is the size of the lines so
> they align properly. I did have to manually set the line height for
> the spartan style.
> > Will this break old custom templates?
> Yes. Is this undesirable? I'll put back the stuff that I removed to
> make it backwards compatible, but then it's slightly inefficient to
> compute the same thing twice.

The extra work is pretty minimal.

> > If you can get this to work for annotate, you'll be a hero: the
> > large tables that annotate throws coupled with a bug in Firefox's
> > incremental table rendering cause it to degrade to O(n^2)
> > performance on large files.
> Huh. I don't understand why annotate is creating large tables at all.
> I can easily see how to kill that with a similar method. Why is
> annotate using tables but filerev isn't?

Probably because we want to right-align names.

Mathematics is the supreme nostalgia of our time.

More information about the Mercurial-devel mailing list