| To: vim-dev@vim.org |
| Subject: Patch 7.1.234 |
| Fcc: outbox |
| From: Bram Moolenaar <Bram@moolenaar.net> |
| Mime-Version: 1.0 |
| Content-Type: text/plain; charset=ISO-8859-1 |
| Content-Transfer-Encoding: 8bit |
| ------------ |
| |
| Patch 7.1.234 |
| Problem: When diff'ing three files the third one isn't displayed correctly. |
| (Gary Johnson) |
| Solution: Compute the size of diff blocks correctly when merging blocks. |
| Compute filler lines correctly when scrolling. |
| Files: src/diff.c |
| |
| |
| *** ../vim-7.1.233/src/diff.c Fri Oct 19 18:57:33 2007 |
| --- src/diff.c Fri Jan 18 17:32:31 2008 |
| *************** |
| *** 1299,1305 **** |
| } |
| else |
| |
| ! dp->df_count[idx_new] += count_new - count_orig; |
| |
| |
| |
| --- 1299,1307 ---- |
| } |
| else |
| |
| ! dp->df_count[idx_new] += count_new - count_orig |
| ! + dpl->df_lnum[idx_orig] + dpl->df_count[idx_orig] |
| ! - (dp->df_lnum[idx_orig] + dp->df_count[idx_orig]); |
| |
| |
| |
| *************** |
| *** 1628,1641 **** |
| win_T *fromwin; |
| win_T *towin; |
| { |
| ! buf_T *buf = fromwin->w_buffer; |
| linenr_T lnum = fromwin->w_topline; |
| ! int idx; |
| diff_T *dp; |
| int i; |
| |
| ! idx = diff_buf_idx(buf); |
| ! if (idx == DB_COUNT) |
| return; |
| |
| if (curtab->tp_diff_invalid) |
| --- 1630,1645 ---- |
| win_T *fromwin; |
| win_T *towin; |
| { |
| ! buf_T *frombuf = fromwin->w_buffer; |
| linenr_T lnum = fromwin->w_topline; |
| ! int fromidx; |
| ! int toidx; |
| diff_T *dp; |
| + int max_count; |
| int i; |
| |
| ! fromidx = diff_buf_idx(frombuf); |
| ! if (fromidx == DB_COUNT) |
| return; |
| |
| if (curtab->tp_diff_invalid) |
| *************** |
| *** 1645,1686 **** |
| |
| |
| for (dp = curtab->tp_first_diff; dp != NULL; dp = dp->df_next) |
| ! if (lnum <= dp->df_lnum[idx] + dp->df_count[idx]) |
| break; |
| if (dp == NULL) |
| { |
| |
| |
| towin->w_topline = towin->w_buffer->b_ml.ml_line_count |
| ! - (buf->b_ml.ml_line_count - lnum); |
| } |
| else |
| { |
| |
| ! i = diff_buf_idx(towin->w_buffer); |
| ! if (i == DB_COUNT) |
| return; |
| |
| ! towin->w_topline = lnum + (dp->df_lnum[i] - dp->df_lnum[idx]); |
| ! if (lnum >= dp->df_lnum[idx]) |
| { |
| ! |
| ! if (dp->df_count[i] == dp->df_count[idx]) |
| towin->w_topfill = fromwin->w_topfill; |
| ! else if (dp->df_count[i] > dp->df_count[idx]) |
| { |
| ! if (lnum == dp->df_lnum[idx] + dp->df_count[idx]) |
| ! towin->w_topline = dp->df_lnum[i] + dp->df_count[i] |
| ! - fromwin->w_topfill; |
| } |
| ! else |
| { |
| ! if (towin->w_topline >= dp->df_lnum[i] + dp->df_count[i]) |
| { |
| ! if (diff_flags & DIFF_FILLER) |
| ! towin->w_topfill = dp->df_lnum[idx] |
| ! + dp->df_count[idx] - lnum; |
| ! towin->w_topline = dp->df_lnum[i] + dp->df_count[i]; |
| } |
| } |
| } |
| --- 1649,1720 ---- |
| |
| |
| for (dp = curtab->tp_first_diff; dp != NULL; dp = dp->df_next) |
| ! if (lnum <= dp->df_lnum[fromidx] + dp->df_count[fromidx]) |
| break; |
| if (dp == NULL) |
| { |
| |
| |
| towin->w_topline = towin->w_buffer->b_ml.ml_line_count |
| ! - (frombuf->b_ml.ml_line_count - lnum); |
| } |
| else |
| { |
| |
| ! toidx = diff_buf_idx(towin->w_buffer); |
| ! if (toidx == DB_COUNT) |
| return; |
| |
| ! towin->w_topline = lnum + (dp->df_lnum[toidx] - dp->df_lnum[fromidx]); |
| ! if (lnum >= dp->df_lnum[fromidx]) |
| { |
| ! |
| |
| ! max_count = 0; |
| ! for (i = 0; i < DB_COUNT; ++i) |
| ! if (curtab->tp_diffbuf[i] != NULL |
| ! && max_count < dp->df_count[i]) |
| ! max_count = dp->df_count[i]; |
| ! |
| ! if (dp->df_count[toidx] == dp->df_count[fromidx]) |
| ! { |
| ! |
| towin->w_topfill = fromwin->w_topfill; |
| ! } |
| ! else if (dp->df_count[toidx] > dp->df_count[fromidx]) |
| { |
| ! if (lnum == dp->df_lnum[fromidx] + dp->df_count[fromidx]) |
| ! { |
| ! |
| |
| ! if (max_count - fromwin->w_topfill >= dp->df_count[toidx]) |
| ! { |
| ! |
| ! towin->w_topline = dp->df_lnum[toidx] |
| ! + dp->df_count[toidx]; |
| ! towin->w_topfill = fromwin->w_topfill; |
| ! } |
| ! else |
| ! |
| ! towin->w_topline = dp->df_lnum[toidx] |
| ! + max_count - fromwin->w_topfill; |
| ! } |
| } |
| ! else if (towin->w_topline >= dp->df_lnum[toidx] |
| ! + dp->df_count[toidx]) |
| { |
| ! |
| |
| ! towin->w_topline = dp->df_lnum[toidx] + dp->df_count[toidx]; |
| ! if (diff_flags & DIFF_FILLER) |
| { |
| ! if (lnum == dp->df_lnum[fromidx] + dp->df_count[fromidx]) |
| ! |
| ! towin->w_topfill = fromwin->w_topfill; |
| ! else |
| ! |
| ! towin->w_topfill = dp->df_lnum[fromidx] |
| ! + max_count - lnum; |
| } |
| } |
| } |
| *** ../vim-7.1.233/src/version.c Fri Jan 18 13:15:32 2008 |
| --- src/version.c Fri Jan 18 17:37:32 2008 |
| *************** |
| *** 668,669 **** |
| --- 668,671 ---- |
| { |
| + |
| + 234, |
| |
| |
| -- |
| ERIC IDLE PLAYED: THE DEAD COLLECTOR, MR BINT (A VILLAGE NE'ER-DO -WELL VERY |
| KEEN ON BURNING WITCHES), SIR ROBIN, THE GUARD WHO DOESN'T |
| HICOUGH BUT TRIES TO GET THINGS STRAIGHT, CONCORDE (SIR |
| LAUNCELOT'S TRUSTY STEED), ROGER THE SHRUBBER (A SHRUBBER), |
| BROTHER MAYNARD |
| "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD |
| |
| /// 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 /// |
| |