|
Karsten Hopp |
9c3490 |
To: vim-dev@vim.org
|
|
Karsten Hopp |
9c3490 |
Subject: Patch 7.1.234
|
|
Karsten Hopp |
9c3490 |
Fcc: outbox
|
|
Karsten Hopp |
9c3490 |
From: Bram Moolenaar <Bram@moolenaar.net>
|
|
Karsten Hopp |
9c3490 |
Mime-Version: 1.0
|
|
Karsten Hopp |
9c3490 |
Content-Type: text/plain; charset=ISO-8859-1
|
|
Karsten Hopp |
9c3490 |
Content-Transfer-Encoding: 8bit
|
|
Karsten Hopp |
9c3490 |
------------
|
|
Karsten Hopp |
9c3490 |
|
|
Karsten Hopp |
9c3490 |
Patch 7.1.234
|
|
Karsten Hopp |
9c3490 |
Problem: When diff'ing three files the third one isn't displayed correctly.
|
|
Karsten Hopp |
9c3490 |
(Gary Johnson)
|
|
Karsten Hopp |
9c3490 |
Solution: Compute the size of diff blocks correctly when merging blocks.
|
|
Karsten Hopp |
9c3490 |
Compute filler lines correctly when scrolling.
|
|
Karsten Hopp |
9c3490 |
Files: src/diff.c
|
|
Karsten Hopp |
9c3490 |
|
|
Karsten Hopp |
9c3490 |
|
|
Karsten Hopp |
9c3490 |
*** ../vim-7.1.233/src/diff.c Fri Oct 19 18:57:33 2007
|
|
Karsten Hopp |
9c3490 |
--- src/diff.c Fri Jan 18 17:32:31 2008
|
|
Karsten Hopp |
9c3490 |
***************
|
|
Karsten Hopp |
9c3490 |
*** 1299,1305 ****
|
|
Karsten Hopp |
9c3490 |
}
|
|
Karsten Hopp |
9c3490 |
else
|
|
Karsten Hopp |
9c3490 |
/* second overlap of new block with existing block */
|
|
Karsten Hopp |
9c3490 |
! dp->df_count[idx_new] += count_new - count_orig;
|
|
Karsten Hopp |
9c3490 |
|
|
Karsten Hopp |
9c3490 |
/* Adjust the size of the block to include all the lines to the
|
|
Karsten Hopp |
9c3490 |
* end of the existing block or the new diff, whatever ends last. */
|
|
Karsten Hopp |
9c3490 |
--- 1299,1307 ----
|
|
Karsten Hopp |
9c3490 |
}
|
|
Karsten Hopp |
9c3490 |
else
|
|
Karsten Hopp |
9c3490 |
/* second overlap of new block with existing block */
|
|
Karsten Hopp |
9c3490 |
! dp->df_count[idx_new] += count_new - count_orig
|
|
Karsten Hopp |
9c3490 |
! + dpl->df_lnum[idx_orig] + dpl->df_count[idx_orig]
|
|
Karsten Hopp |
9c3490 |
! - (dp->df_lnum[idx_orig] + dp->df_count[idx_orig]);
|
|
Karsten Hopp |
9c3490 |
|
|
Karsten Hopp |
9c3490 |
/* Adjust the size of the block to include all the lines to the
|
|
Karsten Hopp |
9c3490 |
* end of the existing block or the new diff, whatever ends last. */
|
|
Karsten Hopp |
9c3490 |
***************
|
|
Karsten Hopp |
9c3490 |
*** 1628,1641 ****
|
|
Karsten Hopp |
9c3490 |
win_T *fromwin;
|
|
Karsten Hopp |
9c3490 |
win_T *towin;
|
|
Karsten Hopp |
9c3490 |
{
|
|
Karsten Hopp |
9c3490 |
! buf_T *buf = fromwin->w_buffer;
|
|
Karsten Hopp |
9c3490 |
linenr_T lnum = fromwin->w_topline;
|
|
Karsten Hopp |
9c3490 |
! int idx;
|
|
Karsten Hopp |
9c3490 |
diff_T *dp;
|
|
Karsten Hopp |
9c3490 |
int i;
|
|
Karsten Hopp |
9c3490 |
|
|
Karsten Hopp |
9c3490 |
! idx = diff_buf_idx(buf);
|
|
Karsten Hopp |
9c3490 |
! if (idx == DB_COUNT)
|
|
Karsten Hopp |
9c3490 |
return; /* safety check */
|
|
Karsten Hopp |
9c3490 |
|
|
Karsten Hopp |
9c3490 |
if (curtab->tp_diff_invalid)
|
|
Karsten Hopp |
9c3490 |
--- 1630,1645 ----
|
|
Karsten Hopp |
9c3490 |
win_T *fromwin;
|
|
Karsten Hopp |
9c3490 |
win_T *towin;
|
|
Karsten Hopp |
9c3490 |
{
|
|
Karsten Hopp |
9c3490 |
! buf_T *frombuf = fromwin->w_buffer;
|
|
Karsten Hopp |
9c3490 |
linenr_T lnum = fromwin->w_topline;
|
|
Karsten Hopp |
9c3490 |
! int fromidx;
|
|
Karsten Hopp |
9c3490 |
! int toidx;
|
|
Karsten Hopp |
9c3490 |
diff_T *dp;
|
|
Karsten Hopp |
9c3490 |
+ int max_count;
|
|
Karsten Hopp |
9c3490 |
int i;
|
|
Karsten Hopp |
9c3490 |
|
|
Karsten Hopp |
9c3490 |
! fromidx = diff_buf_idx(frombuf);
|
|
Karsten Hopp |
9c3490 |
! if (fromidx == DB_COUNT)
|
|
Karsten Hopp |
9c3490 |
return; /* safety check */
|
|
Karsten Hopp |
9c3490 |
|
|
Karsten Hopp |
9c3490 |
if (curtab->tp_diff_invalid)
|
|
Karsten Hopp |
9c3490 |
***************
|
|
Karsten Hopp |
9c3490 |
*** 1645,1686 ****
|
|
Karsten Hopp |
9c3490 |
|
|
Karsten Hopp |
9c3490 |
/* search for a change that includes "lnum" in the list of diffblocks. */
|
|
Karsten Hopp |
9c3490 |
for (dp = curtab->tp_first_diff; dp != NULL; dp = dp->df_next)
|
|
Karsten Hopp |
9c3490 |
! if (lnum <= dp->df_lnum[idx] + dp->df_count[idx])
|
|
Karsten Hopp |
9c3490 |
break;
|
|
Karsten Hopp |
9c3490 |
if (dp == NULL)
|
|
Karsten Hopp |
9c3490 |
{
|
|
Karsten Hopp |
9c3490 |
/* After last change, compute topline relative to end of file; no
|
|
Karsten Hopp |
9c3490 |
* filler lines. */
|
|
Karsten Hopp |
9c3490 |
towin->w_topline = towin->w_buffer->b_ml.ml_line_count
|
|
Karsten Hopp |
9c3490 |
! - (buf->b_ml.ml_line_count - lnum);
|
|
Karsten Hopp |
9c3490 |
}
|
|
Karsten Hopp |
9c3490 |
else
|
|
Karsten Hopp |
9c3490 |
{
|
|
Karsten Hopp |
9c3490 |
/* Find index for "towin". */
|
|
Karsten Hopp |
9c3490 |
! i = diff_buf_idx(towin->w_buffer);
|
|
Karsten Hopp |
9c3490 |
! if (i == DB_COUNT)
|
|
Karsten Hopp |
9c3490 |
return; /* safety check */
|
|
Karsten Hopp |
9c3490 |
|
|
Karsten Hopp |
9c3490 |
! towin->w_topline = lnum + (dp->df_lnum[i] - dp->df_lnum[idx]);
|
|
Karsten Hopp |
9c3490 |
! if (lnum >= dp->df_lnum[idx])
|
|
Karsten Hopp |
9c3490 |
{
|
|
Karsten Hopp |
9c3490 |
! /* Inside a change: compute filler lines. */
|
|
Karsten Hopp |
9c3490 |
! if (dp->df_count[i] == dp->df_count[idx])
|
|
Karsten Hopp |
9c3490 |
towin->w_topfill = fromwin->w_topfill;
|
|
Karsten Hopp |
9c3490 |
! else if (dp->df_count[i] > dp->df_count[idx])
|
|
Karsten Hopp |
9c3490 |
{
|
|
Karsten Hopp |
9c3490 |
! if (lnum == dp->df_lnum[idx] + dp->df_count[idx])
|
|
Karsten Hopp |
9c3490 |
! towin->w_topline = dp->df_lnum[i] + dp->df_count[i]
|
|
Karsten Hopp |
9c3490 |
! - fromwin->w_topfill;
|
|
Karsten Hopp |
9c3490 |
}
|
|
Karsten Hopp |
9c3490 |
! else
|
|
Karsten Hopp |
9c3490 |
{
|
|
Karsten Hopp |
9c3490 |
! if (towin->w_topline >= dp->df_lnum[i] + dp->df_count[i])
|
|
Karsten Hopp |
9c3490 |
{
|
|
Karsten Hopp |
9c3490 |
! if (diff_flags & DIFF_FILLER)
|
|
Karsten Hopp |
9c3490 |
! towin->w_topfill = dp->df_lnum[idx]
|
|
Karsten Hopp |
9c3490 |
! + dp->df_count[idx] - lnum;
|
|
Karsten Hopp |
9c3490 |
! towin->w_topline = dp->df_lnum[i] + dp->df_count[i];
|
|
Karsten Hopp |
9c3490 |
}
|
|
Karsten Hopp |
9c3490 |
}
|
|
Karsten Hopp |
9c3490 |
}
|
|
Karsten Hopp |
9c3490 |
--- 1649,1720 ----
|
|
Karsten Hopp |
9c3490 |
|
|
Karsten Hopp |
9c3490 |
/* search for a change that includes "lnum" in the list of diffblocks. */
|
|
Karsten Hopp |
9c3490 |
for (dp = curtab->tp_first_diff; dp != NULL; dp = dp->df_next)
|
|
Karsten Hopp |
9c3490 |
! if (lnum <= dp->df_lnum[fromidx] + dp->df_count[fromidx])
|
|
Karsten Hopp |
9c3490 |
break;
|
|
Karsten Hopp |
9c3490 |
if (dp == NULL)
|
|
Karsten Hopp |
9c3490 |
{
|
|
Karsten Hopp |
9c3490 |
/* After last change, compute topline relative to end of file; no
|
|
Karsten Hopp |
9c3490 |
* filler lines. */
|
|
Karsten Hopp |
9c3490 |
towin->w_topline = towin->w_buffer->b_ml.ml_line_count
|
|
Karsten Hopp |
9c3490 |
! - (frombuf->b_ml.ml_line_count - lnum);
|
|
Karsten Hopp |
9c3490 |
}
|
|
Karsten Hopp |
9c3490 |
else
|
|
Karsten Hopp |
9c3490 |
{
|
|
Karsten Hopp |
9c3490 |
/* Find index for "towin". */
|
|
Karsten Hopp |
9c3490 |
! toidx = diff_buf_idx(towin->w_buffer);
|
|
Karsten Hopp |
9c3490 |
! if (toidx == DB_COUNT)
|
|
Karsten Hopp |
9c3490 |
return; /* safety check */
|
|
Karsten Hopp |
9c3490 |
|
|
Karsten Hopp |
9c3490 |
! towin->w_topline = lnum + (dp->df_lnum[toidx] - dp->df_lnum[fromidx]);
|
|
Karsten Hopp |
9c3490 |
! if (lnum >= dp->df_lnum[fromidx])
|
|
Karsten Hopp |
9c3490 |
{
|
|
Karsten Hopp |
9c3490 |
! /* Inside a change: compute filler lines. With three or more
|
|
Karsten Hopp |
9c3490 |
! * buffers we need to know the largest count. */
|
|
Karsten Hopp |
9c3490 |
! max_count = 0;
|
|
Karsten Hopp |
9c3490 |
! for (i = 0; i < DB_COUNT; ++i)
|
|
Karsten Hopp |
9c3490 |
! if (curtab->tp_diffbuf[i] != NULL
|
|
Karsten Hopp |
9c3490 |
! && max_count < dp->df_count[i])
|
|
Karsten Hopp |
9c3490 |
! max_count = dp->df_count[i];
|
|
Karsten Hopp |
9c3490 |
!
|
|
Karsten Hopp |
9c3490 |
! if (dp->df_count[toidx] == dp->df_count[fromidx])
|
|
Karsten Hopp |
9c3490 |
! {
|
|
Karsten Hopp |
9c3490 |
! /* same number of lines: use same filler count */
|
|
Karsten Hopp |
9c3490 |
towin->w_topfill = fromwin->w_topfill;
|
|
Karsten Hopp |
9c3490 |
! }
|
|
Karsten Hopp |
9c3490 |
! else if (dp->df_count[toidx] > dp->df_count[fromidx])
|
|
Karsten Hopp |
9c3490 |
{
|
|
Karsten Hopp |
9c3490 |
! if (lnum == dp->df_lnum[fromidx] + dp->df_count[fromidx])
|
|
Karsten Hopp |
9c3490 |
! {
|
|
Karsten Hopp |
9c3490 |
! /* more lines in towin and fromwin doesn't show diff
|
|
Karsten Hopp |
9c3490 |
! * lines, only filler lines */
|
|
Karsten Hopp |
9c3490 |
! if (max_count - fromwin->w_topfill >= dp->df_count[toidx])
|
|
Karsten Hopp |
9c3490 |
! {
|
|
Karsten Hopp |
9c3490 |
! /* towin also only shows filler lines */
|
|
Karsten Hopp |
9c3490 |
! towin->w_topline = dp->df_lnum[toidx]
|
|
Karsten Hopp |
9c3490 |
! + dp->df_count[toidx];
|
|
Karsten Hopp |
9c3490 |
! towin->w_topfill = fromwin->w_topfill;
|
|
Karsten Hopp |
9c3490 |
! }
|
|
Karsten Hopp |
9c3490 |
! else
|
|
Karsten Hopp |
9c3490 |
! /* towin still has some diff lines to show */
|
|
Karsten Hopp |
9c3490 |
! towin->w_topline = dp->df_lnum[toidx]
|
|
Karsten Hopp |
9c3490 |
! + max_count - fromwin->w_topfill;
|
|
Karsten Hopp |
9c3490 |
! }
|
|
Karsten Hopp |
9c3490 |
}
|
|
Karsten Hopp |
9c3490 |
! else if (towin->w_topline >= dp->df_lnum[toidx]
|
|
Karsten Hopp |
9c3490 |
! + dp->df_count[toidx])
|
|
Karsten Hopp |
9c3490 |
{
|
|
Karsten Hopp |
9c3490 |
! /* less lines in towin and no diff lines to show: compute
|
|
Karsten Hopp |
9c3490 |
! * filler lines */
|
|
Karsten Hopp |
9c3490 |
! towin->w_topline = dp->df_lnum[toidx] + dp->df_count[toidx];
|
|
Karsten Hopp |
9c3490 |
! if (diff_flags & DIFF_FILLER)
|
|
Karsten Hopp |
9c3490 |
{
|
|
Karsten Hopp |
9c3490 |
! if (lnum == dp->df_lnum[fromidx] + dp->df_count[fromidx])
|
|
Karsten Hopp |
9c3490 |
! /* fromwin is also out of diff lines */
|
|
Karsten Hopp |
9c3490 |
! towin->w_topfill = fromwin->w_topfill;
|
|
Karsten Hopp |
9c3490 |
! else
|
|
Karsten Hopp |
9c3490 |
! /* fromwin has some diff lines */
|
|
Karsten Hopp |
9c3490 |
! towin->w_topfill = dp->df_lnum[fromidx]
|
|
Karsten Hopp |
9c3490 |
! + max_count - lnum;
|
|
Karsten Hopp |
9c3490 |
}
|
|
Karsten Hopp |
9c3490 |
}
|
|
Karsten Hopp |
9c3490 |
}
|
|
Karsten Hopp |
9c3490 |
*** ../vim-7.1.233/src/version.c Fri Jan 18 13:15:32 2008
|
|
Karsten Hopp |
9c3490 |
--- src/version.c Fri Jan 18 17:37:32 2008
|
|
Karsten Hopp |
9c3490 |
***************
|
|
Karsten Hopp |
9c3490 |
*** 668,669 ****
|
|
Karsten Hopp |
9c3490 |
--- 668,671 ----
|
|
Karsten Hopp |
9c3490 |
{ /* Add new patch number below this line */
|
|
Karsten Hopp |
9c3490 |
+ /**/
|
|
Karsten Hopp |
9c3490 |
+ 234,
|
|
Karsten Hopp |
9c3490 |
/**/
|
|
Karsten Hopp |
9c3490 |
|
|
Karsten Hopp |
9c3490 |
--
|
|
Karsten Hopp |
9c3490 |
ERIC IDLE PLAYED: THE DEAD COLLECTOR, MR BINT (A VILLAGE NE'ER-DO -WELL VERY
|
|
Karsten Hopp |
9c3490 |
KEEN ON BURNING WITCHES), SIR ROBIN, THE GUARD WHO DOESN'T
|
|
Karsten Hopp |
9c3490 |
HICOUGH BUT TRIES TO GET THINGS STRAIGHT, CONCORDE (SIR
|
|
Karsten Hopp |
9c3490 |
LAUNCELOT'S TRUSTY STEED), ROGER THE SHRUBBER (A SHRUBBER),
|
|
Karsten Hopp |
9c3490 |
BROTHER MAYNARD
|
|
Karsten Hopp |
9c3490 |
"Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD
|
|
Karsten Hopp |
9c3490 |
|
|
Karsten Hopp |
9c3490 |
/// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
|
|
Karsten Hopp |
9c3490 |
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
|
|
Karsten Hopp |
9c3490 |
\\\ download, build and distribute -- http://www.A-A-P.org ///
|
|
Karsten Hopp |
9c3490 |
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
|