[PATCH RFC V2] hgweb: code selection without line numbers in file source view

Alexander Plavin me at aplavin.ru
Mon Jul 1 02:43:28 CDT 2013


2013/7/1 Matt Mackall <mpm at selenic.com>:
> On Thu, 2013-06-27 at 17:34 +0400, Alexander Plavin wrote:
>> -  <div class="parity{parity} source"><a href="#{lineid}" id="{lineid}">{linenumber}</a> {line|escape}</div>'
>> +  <li class="parity{parity} source" id="{lineid}"><div>{ifeq(strip(line, '\r\n'), '', ' ', '')}{strip(line|escape, "\r\n")}</div></li>'
>
> This is, in my opinion, the worst sort of thing you can do as a software
> engineer.
>
> Here you have broken a perfectly good, working feature (anchor links)
> to introduce another. You have taken one step back and one step forward
> in a different direction. In some very real sense, your net progress is
> _worse than zero_ because you've taken away something that some people
> already rely on[1] and replaced it with something that none of your
> users currently rely on.

Not sure what you mean but breaking anchor links - but they work here
(but you can't get it by clicking on the line number, only by typing
into the URL or receiving a given one). The ability to get link on
click is added again in the next patch.

>
> In doing so, you've given people a good reason to dread upgrading. Make
> this sort of trade-off a dozen times in a development cycle, and you're
> now developing the sort of software I absolutely loathe.
>
> In fact, this is the sort of thing we call a 'regression' on our BTS,
> and automatically bump to a higher priority than other issues. It's the
> sort of (rare) thing we delay releases for and do large reverts to fix.
>
>
> I think at this point we need to step back and look at the prerequisites
> for what you're trying to do here:
>
> - correct display:
>    - indentation [2]
>    - embedded whitespace
>    - monospace

Can't see where the display is incorrect when using my code (it runs
at hg.aplavin.ru).

> - anchor links

Commented above.

> + nice cut and paste
>    + no line numbers
>    + correct embedded whitespace
>
> If you have to mangle the whitespace to get rid of the line numbers, I
> don't really see the point in trying: you can't paste it into your
> editor without editing anyway.
>
> I put together this test case on Friday:
>
>  http://www.selenic.com/space.html
>
> ..and it does not look at all promising, especially with tabs.
>
> Since the exisiting <pre> style seems to mostly work, perhaps this is a
> situation where we should use Javascript. Stick to the existing HTML,
> but post-process it to turn the line number into a CSS decoration ala
>
>  http://en.support.wordpress.com/code/posting-source-code/

Even the last example at their page displays incorrectly for me, so
probably not a good example.

>
>
> By the way, I mentioned if() last time around (not ifeq) on purpose:
>
> ifeq(x, '', a, b) -> if(x, a, b)
>
>
> [1] I personally use these anchor links at least once a day
> [2] We have a known issue with the first tab being too small
> --
> Mathematics is the supreme nostalgia of our time.
>
>


More information about the Mercurial-devel mailing list