D3212: patch: implement a new worddiff algorithm

quark (Jun Wu) phabricator at mercurial-scm.org
Mon Apr 9 21:57:38 EDT 2018


quark added inline comments.

INLINE COMMENTS

> spectral wrote in color.py:94
> These are the first uses of 'dim' in the default set of things, and I don't think we can rely on it; for color.mode=auto, we really mean "ansi" (aka ecma48) (unless on windows), and don't do any detection of capabilities, so we just output \e[2m and some terminals just ignore that (like mine, rxvt-unicode v9.22).  If using color.mode=terminfo, we at least get error messages (I did --config color.log.user='dim green'):
> 
> ignoring unknown color/effect 'dim' (configured in color.log.user)
> 
> Apparently cygwin doesn't advertise 'dim', and while the linux virtual console advertises it and supports it, it doesn't actually support a dim color (at least on my machine), it just always puts it in a weird blue :)
> 
> I think I'd prefer that `changed` be bold and `unchanged` be non-bold.  For most terminals, that'll lead to a visible difference in intensity (bold being brighter unless using a weird palette), and for those that aren't configured for that, it'll at least be a heavier weight.  It's better than having literally zero difference between them without any explanation why.  I think it'll also be more obvious which lines have it; in your screenshot the difference between dim and regular is pretty subtle.

As I mentioned in the summary, I believe `diff.inserted` and `diff.inserted.changed` should have a same color. And `diff.inserted` probably shouldn't be bold.

Looking at this review page, you will notice the `diff.inserted` and `diff.inserted.changed` are using a same color, where `diff.inserted.unchanged` is using a different (lighter) background color.

`dim` works fine where it is supported. For terminals that do not support it, people can override the settings. For `dim` feature detection, that's an issue in the color code which is unrelated to this change. Since worddiff is experimental and off by default, I don't think dim detection should block this patch.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D3212

To: quark, #hg-reviewers, durin42
Cc: spectral, mercurial-devel


More information about the Mercurial-devel mailing list