To: vim-dev@vim.org Subject: Patch 6.2.280 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit ------------ Patch 6.2.280 Problem: "do" and ":diffget" don't work in the first line and the last line of a buffer. (Aron Griffis) Solution: Find a difference above the first line and below the last line. Also fix a few display updating bugs. Files: src/diff.c, src/fold.c, src/move.c *** ../vim-6.2.279/src/diff.c Tue Feb 17 21:36:55 2004 --- src/diff.c Thu Feb 19 21:35:17 2004 *************** *** 411,416 **** --- 411,420 ---- } diff_redraw(TRUE); + + /* Recompute the scroll binding, may remove or add filler lines (e.g., + * when adding lines above w_topline). */ + check_scrollbind((linenr_T)0, 0L); } /* *************** *** 538,543 **** --- 542,548 ---- int dofold; /* also recompute the folds */ { win_T *wp; + int n; for (wp = firstwin; wp != NULL; wp = wp->w_next) if (wp->w_p_diff) *************** *** 547,552 **** --- 552,565 ---- if (dofold && foldmethodIsDiff(wp)) foldUpdateAll(wp); #endif + /* A change may have made filler lines invalid, need to take care + * of that for other windows. */ + if (wp != curwin && wp->w_topfill > 0) + { + n = diff_check(wp, wp->w_topline); + if (wp->w_topfill > n) + wp->w_topfill = (n < 0 ? 0 : n); + } } } *************** *** 1804,1812 **** diff_busy = TRUE; ! /* When no range given include the line above the cursor. */ ! if (eap->addr_count == 0 && eap->line1 > 1) ! --eap->line1; if (eap->cmdidx == CMD_diffget) { --- 1817,1835 ---- diff_busy = TRUE; ! /* When no range given include the line above or below the cursor. */ ! if (eap->addr_count == 0) ! { ! /* Make it possible that ":diffget" on the last line gets line below ! * the cursor line when there is no difference above the cursor. */ ! if (eap->cmdidx == CMD_diffget ! && eap->line1 == curbuf->b_ml.ml_line_count ! && diff_check(curwin, eap->line1) == 0 ! && (eap->line1 == 1 || diff_check(curwin, eap->line1 - 1) == 0)) ! ++eap->line2; ! else if (eap->line1 > 0) ! --eap->line1; ! } if (eap->cmdidx == CMD_diffget) { *** ../vim-6.2.279/src/fold.c Tue Jan 27 17:55:24 2004 --- src/fold.c Thu Feb 19 20:55:36 2004 *************** *** 837,843 **** /* foldUpdateAll() {{{2 */ /* ! * Update all lines in the current window for folding. * Used when a fold setting changes or after reloading the buffer. * The actual updating is postponed until fold info is used, to avoid doing * every time a setting is changed or a syntax item is added. --- 837,843 ---- /* foldUpdateAll() {{{2 */ /* ! * Update all lines in a window for folding. * Used when a fold setting changes or after reloading the buffer. * The actual updating is postponed until fold info is used, to avoid doing * every time a setting is changed or a syntax item is added. *************** *** 847,853 **** win_T *win; { win->w_foldinvalid = TRUE; ! redraw_later(NOT_VALID); } /* foldMoveTo() {{{2 */ --- 847,853 ---- win_T *win; { win->w_foldinvalid = TRUE; ! redraw_win_later(win, NOT_VALID); } /* foldMoveTo() {{{2 */ *** ../vim-6.2.279/src/move.c Thu Feb 13 20:08:09 2003 --- src/move.c Thu Feb 19 19:47:30 2004 *************** *** 207,219 **** check_topline = TRUE; else if (check_top_offset()) check_topline = TRUE; #ifdef FEAT_DIFF /* Check if there are more filler lines than allowed. */ ! else if (curwin->w_topfill > diff_check_fill(curwin, curwin->w_topline)) ! check_topline = TRUE; #endif - } if (check_topline) { --- 207,219 ---- check_topline = TRUE; else if (check_top_offset()) check_topline = TRUE; + } #ifdef FEAT_DIFF /* Check if there are more filler lines than allowed. */ ! if (!check_topline && curwin->w_topfill > diff_check_fill(curwin, curwin->w_topline)) ! check_topline = TRUE; #endif if (check_topline) { *************** *** 746,752 **** #ifdef FEAT_DIFF if (lnum == wp->w_topline) wp->w_cline_row += plines_win_nofill(wp, lnum++, TRUE) ! + wp->w_topfill; else #endif wp->w_cline_row += plines_win(wp, lnum++, TRUE); --- 746,752 ---- #ifdef FEAT_DIFF if (lnum == wp->w_topline) wp->w_cline_row += plines_win_nofill(wp, lnum++, TRUE) ! + wp->w_topfill; else #endif wp->w_cline_row += plines_win(wp, lnum++, TRUE); *** ../vim-6.2.279/src/version.c Thu Feb 19 15:31:20 2004 --- src/version.c Fri Feb 20 21:33:40 2004 *************** *** 639,640 **** --- 639,642 ---- { /* Add new patch number below this line */ + /**/ + 280, /**/ -- $ echo pizza > /dev/oven /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// Sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ Project leader for A-A-P -- http://www.A-A-P.org /// \\\ Help AIDS victims, buy here: http://ICCF-Holland.org/click1.html ///