On Monday, June 11, 2012 1:06:03 PM UTC-5, Christian Brabandt wrote:
> Hi Ben!
> 
> On So, 10 Jun 2012, Ben Fritz wrote:
> 
> > On Sunday, June 10, 2012 7:52:37 AM UTC-5, Christian Brabandt wrote:
> > > 
> > > 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.
> 

Oops! I was trying to be lazy since I wasn't sure exactly what the output
format was going to be, but forgot about different locales. I'll do
something about that before I release the plugin. Thanks.

> 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.

I suspected as much...but didn't have time yet to puzzle out how that code
was supposed to work. Thanks for looking into it!

> 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 applied the patch and things do behave better now. Thanks! Something is
still off, however. It looks like some leading diff filler is missing. See
attached screenshots:

patched_window2.png shows that the alignment at least works, and the
DiffChange and DiffText highlighting is correct.

But patched_window1.png shows that the second window ought to have some
leading diff filler which is missing, screwing up the alignment. All I did
between these screenshots is CTRL-W_W to switch windows. The jump in window
position when I do this was actually pretty surprising; I thought it was
fixed entirely until I switched windows.

-- 
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

Raspunde prin e-mail lui