To: vim-dev@vim.org Subject: Patch 7.2.366 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 7.2.366 Problem: CTRL-B doesn't go back to the first line of the buffer. Solution: Avoid an overflow when adding MAXCOL. Files: src/move.c *** ../vim-7.2.365/src/move.c 2010-02-03 17:42:59.000000000 +0100 --- src/move.c 2010-02-17 17:49:34.000000000 +0100 *************** *** 1610,1616 **** * Add one line above "lp->lnum". This can be a filler line, a closed fold or * a (wrapped) text line. Uses and sets "lp->fill". * Returns the height of the added line in "lp->height". ! * Lines above the first one are incredibly high. */ static void topline_back(lp) --- 1610,1616 ---- * Add one line above "lp->lnum". This can be a filler line, a closed fold or * a (wrapped) text line. Uses and sets "lp->fill". * Returns the height of the added line in "lp->height". ! * Lines above the first one are incredibly high: MAXCOL. */ static void topline_back(lp) *************** *** 1942,1948 **** { loff.lnum = curwin->w_topline; topline_back(&loff); ! if (used + loff.height > curwin->w_height) break; used += loff.height; #ifdef FEAT_DIFF --- 1942,1948 ---- { loff.lnum = curwin->w_topline; topline_back(&loff); ! if (loff.height == MAXCOL || used + loff.height > curwin->w_height) break; used += loff.height; #ifdef FEAT_DIFF *************** *** 2021,2027 **** /* Add one line above */ topline_back(&loff); ! used += loff.height; if (used > curwin->w_height) break; if (loff.lnum >= curwin->w_botline --- 2021,2030 ---- /* Add one line above */ topline_back(&loff); ! if (loff.height == MAXCOL) ! used = MAXCOL; ! else ! used += loff.height; if (used > curwin->w_height) break; if (loff.lnum >= curwin->w_botline *************** *** 2175,2181 **** if (below > above) /* add a line above the cursor */ { topline_back(&loff); ! used += loff.height; if (used > curwin->w_height) break; above += loff.height; --- 2178,2187 ---- if (below > above) /* add a line above the cursor */ { topline_back(&loff); ! if (loff.height == MAXCOL) ! used = MAXCOL; ! else ! used += loff.height; if (used > curwin->w_height) break; above += loff.height; *************** *** 2472,2480 **** while (n <= curwin->w_height && loff.lnum >= 1) { topline_back(&loff); ! n += loff.height; } ! if (n <= curwin->w_height) /* at begin of file */ { curwin->w_topline = 1; #ifdef FEAT_DIFF --- 2478,2489 ---- while (n <= curwin->w_height && loff.lnum >= 1) { topline_back(&loff); ! if (loff.height == MAXCOL) ! n = MAXCOL; ! else ! n += loff.height; } ! if (loff.lnum < 1) /* at begin of file */ { curwin->w_topline = 1; #ifdef FEAT_DIFF *** ../vim-7.2.365/src/version.c 2010-02-17 17:34:38.000000000 +0100 --- src/version.c 2010-02-17 18:13:22.000000000 +0100 *************** *** 683,684 **** --- 683,686 ---- { /* Add new patch number below this line */ + /**/ + 366, /**/ -- hundred-and-one symptoms of being an internet addict: 247. You use www.switchboard.com instead of dialing 411 and 555-12-12 for directory assistance. /// 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 ///