Wednesday, June 23, 2010

Re: gvimdiff can not hightlight correctly the difference in a line

Yu Peng wrote:

> On Jun 23, 3:15 pm, Gary Johnson <garyj...@spocom.com> wrote:
> > On 2010-06-23, Peng Yu wrote:
> >
> > > Suppose that I have the following two lines in two files (each in one
> > > file), gvimdiff highlight everything after '=' without knowing that
> > > 'sdsafdasfa' is the same in both lines. Is there a way to make
> > > gvimdiff be aware of the commonality flanked by two mismatches?
> >
> > > i =x.y 19 sdsafdasfa xx
> > > i = 19 sdsafdasfa
> >
> > No. See ":help :diffu" and scroll down a bit to where it says this.
> >
> > |hl-DiffText| DiffText Changed text inside a Changed line. Vim
> > finds the first character that is different,
> > and the last character that is different
> > (searching from the end of the line). The
> > text in between is highlighted. This means
> > that parts in the middle that are still the
> > same are highlighted anyway. Only "iwhite" of
> > 'diffopt' is used here.
>
> I'm wondering why this can not be improved. Is it because if the
> computation of internal common text is time consuming? But if the text
> line is bounded, the runtime will be bounded as well.

You would have to run the diff algorithm on the lines. It's not as easy
as it seem to find a middle part that is equal, since you don't know
where to start.

Some time ago someone sent code to handle diff internally instead of
invoking an external program. That could be used. Unfortunately that
didn't get turned into a patch yet.
http://www.ioplex.com/~miallen/libmba/dl/src/diff.c

--
hundred-and-one symptoms of being an internet addict:
234. You started college as a chemistry major, and walk out four years
later as an Internet provider.

/// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ download, build and distribute -- http://www.A-A-P.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

No comments: