Re: [PATCH take 3 0/4] color-words improvements

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Johannes Schindelin <Johannes.Schindelin@xxxxxx> writes:

> BTW this gets even worse when you compare the following:
>
> bbb aaa
> ccc aaa
>
> --color-words=a+ will show
>
> ccc aaa

Naive question.  What is the expected output?

The user defines that "a", "aa", "aaa",... are words and everything else
is the background that the words float on, and asks --color-words to color
code where the words differ.  The way to show them is to have the words in
red (if it comes from preimage) or in green (if it comes from postimage) on
top of some background.

In this case, there is no difference in words, and the only difference is
the background.  Should we still see any output?  Shouldn't it behave more
like "diff -w" that suppresses lines that differ only in whitespace?

I didn't see the semantics of color-words documented in the original
either, and I think it should be described in a way humans would
understand (in other words, "here is what we do internally, splitting
words into lines, running diff between them and coalescing the result in
this and that way, and whatever happens to be output is what you get" is
not the semantics that is explained in a way humans would understand).

The above "The way to show them is to have the words in red (if it comes
from preimage) or in green (if it comes from postimage) on top of some
background." was my attempt to describe an easier half of the semantics,
but I am not sure what definition of "some background" the current draft
code is designed around; I think the original's definition was "we discard
the background from either preimage or postimage and insert whitespace
outselves between the words we output; the only exception is the
end-of-line that appears in the postimage which we try to keep" or
something like that, but that is not written in the documentation either.

How should the background computed to draw the result on?  If a
corresponding background portion appear in both the preimage and the
postimage, we use the one from the postimage?  That justifies why bbb is
not shown but ccc is, when you compare these two:

  bbb aaa
  ccc aa

What happens if a portion of background is only in the preimage?
E.g. when these two are compared:

  bbb aaa bb aa b
  ccc aaa cc

what should happen?  We would want to say "aa" was removed by showing it
in red, but on what background should it be displayed?  cc <red>aa</red>
b?
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux