Christian Brabandt wrote:
> On So, 10 Jun 2012, Ben Fritz wrote:
>
> > On Sunday, June 10, 2012 7:52:37 AM UTC-5, Christian Brabandt wrote:
> > > How did you generate the aligned.patch file? No matter what I do, for me
> > > the plugin always generates:
> > >
> > > 2,7c2,4
> > > < a
> > > < b
> > > < cb
> > > < db
> > > < eb
> > > < f
> > > ---
> > > > cc
> > > > dd
> > > > ee
> > >
> > > But perhaps, I'm using your plugin wrongly, e.g. how many alignemnt
> > > points do I have to set and where? But even after I manually copied the
> > > aligned.patch file over the resulting file, Vim still gets the alignment
> > > wrong.
> > >
> >
> > Oh, sorry.
> >
> > enter the text shown in the screenshots, place the cursor on line 4 of
> > file_a.txt ("cb"), press <Leader>mda to "mark diff alignment". Go to
> > line 2 of file_b.txt and again type <Leader>mda> to indicate that
> > those two points correspond to each other. Then run :diffupdate.
>
> I did that. I still get the above patch. Ah, I found the problem. You
> are parsing the output of sign place, and on my localized version it
> prints:
>
> :sign place
> --- Zeichen ---
> Zeichen für ../diff1.txt:
> Zeile=2 id=1339437602 Name=manDiffAlign01
> Zeichen für ../diff2.txt:
> Zeile=4 id=1339437599 Name=manDiffAlign01
>
> So it is probably better to look for the first equal sign.
>
> After changing my Vim to an english localization I could reproduce your
> issue. I think the problem is, that Vim thinks, the 2 diff regions are
> overlapping. This looks like an "off-by 1" error for me, and indeed this
> patch fixes it for me:
>
> diff --git a/src/diff.c b/src/diff.c
> --- a/src/diff.c
> +++ b/src/diff.c
> @@ -1318,8 +1318,8 @@
> }
>
> if (dp != NULL
> - && lnum_orig <= dp->df_lnum[idx_orig] + dp->df_count[idx_orig]
> - && lnum_orig + count_orig >= dp->df_lnum[idx_orig])
> + && lnum_orig < dp->df_lnum[idx_orig] + dp->df_count[idx_orig]
> + && lnum_orig + count_orig > dp->df_lnum[idx_orig])
> {
> /* New block overlaps with existing block(s).
> * First find last block that overlaps. */
I'm not sure including this patch will not cause problems. The code
assumes there is always at least one unchanged lines between diff
blocks. When two blocks are touching (no line in between) that means
they should actually be one block.
Changing the assumption is tricky, it might work in some cases but not
always. It may cause problems for commands like "do" and "dp".
We would at least need some good tests to make sure nothing breaks.
--
hundred-and-one symptoms of being an internet addict:
30. Even though you died last week, you've managed to retain OPS on your
favorite IRC channel.
/// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
--
You received this message from the "vim_dev" 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