To: vim-dev@vim.org Subject: Patch 6.0.090 Fcc: outbox From: Bram Moolenaar MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit ------------ Patch 6.0.090 Problem: When a wrapping line does not fit in a window and 'scrolloff' is bigger than half the window height, moving the cursor left or right causes the screen to flash badly. (Lubomir Host) Solution: When there is not enough room to show 'scrolloff' screen lines and near the end of the line, show the end of the line. Files: src/move.c *** ../vim60.89/src/move.c Sat Sep 29 10:11:29 2001 --- src/move.c Tue Nov 6 21:38:50 2001 *************** *** 931,936 **** --- 931,937 ---- int extra; /* offset for first screen line */ int off; int n; + int p_lines; int width = 0; int textwidth; int new_leftcol; *************** *** 1071,1081 **** prev_skipcol = curwin->w_skipcol; ! n = 0; if ((curwin->w_wrow >= curwin->w_height || ((prev_skipcol > 0 || curwin->w_wrow + p_so >= curwin->w_height) ! && (n = #ifdef FEAT_DIFF plines_win_nofill #else --- 1072,1082 ---- prev_skipcol = curwin->w_skipcol; ! p_lines = 0; if ((curwin->w_wrow >= curwin->w_height || ((prev_skipcol > 0 || curwin->w_wrow + p_so >= curwin->w_height) ! && (p_lines = #ifdef FEAT_DIFF plines_win_nofill #else *************** *** 1102,1116 **** extra = 1; /* Compute last display line of the buffer line that we want at the * bottom of the window. */ ! if (n == 0) ! n = plines_win(curwin, curwin->w_cursor.lnum, FALSE); ! --n; ! if (curwin->w_wrow + p_so < n) n = curwin->w_wrow + p_so; if ((colnr_T)n >= curwin->w_height + curwin->w_skipcol / width) extra += 2; ! if (extra == 3) { /* not enough room for 'scrolloff', put cursor in the middle */ n = curwin->w_virtcol / width; --- 1103,1119 ---- extra = 1; /* Compute last display line of the buffer line that we want at the * bottom of the window. */ ! if (p_lines == 0) ! p_lines = plines_win(curwin, curwin->w_cursor.lnum, FALSE); ! --p_lines; ! if (p_lines > curwin->w_wrow + p_so) n = curwin->w_wrow + p_so; + else + n = p_lines; if ((colnr_T)n >= curwin->w_height + curwin->w_skipcol / width) extra += 2; ! if (extra == 3 || p_lines < p_so * 2) { /* not enough room for 'scrolloff', put cursor in the middle */ n = curwin->w_virtcol / width; *************** *** 1118,1123 **** --- 1121,1129 ---- n -= curwin->w_height / 2; else n = 0; + /* don't skip more than necessary */ + if (n > p_lines - curwin->w_height + 1) + n = p_lines - curwin->w_height + 1; curwin->w_skipcol = n * width; } else if (extra == 1) *************** *** 1149,1160 **** curwin->w_wrow -= extra; } ! extra = (curwin->w_skipcol - prev_skipcol) / width; if (extra > 0) win_ins_lines(curwin, 0, extra, FALSE, FALSE); else if (extra < 0) win_del_lines(curwin, 0, -extra, FALSE, FALSE); - } else curwin->w_skipcol = 0; --- 1155,1165 ---- curwin->w_wrow -= extra; } ! extra = ((int)prev_skipcol - (int)curwin->w_skipcol) / width; if (extra > 0) win_ins_lines(curwin, 0, extra, FALSE, FALSE); else if (extra < 0) win_del_lines(curwin, 0, -extra, FALSE, FALSE); } else curwin->w_skipcol = 0; *** ../vim60.89/src/version.c Tue Nov 6 19:43:29 2001 --- src/version.c Tue Nov 6 21:42:02 2001 *************** *** 608,609 **** --- 608,611 ---- { /* Add new patch number below this line */ + /**/ + 90, /**/ -- How To Keep A Healthy Level Of Insanity: 2. Page yourself over the intercom. Don't disguise your voice. /// Bram Moolenaar -- Bram@moolenaar.net -- http://www.moolenaar.net \\\ ((( Creator of Vim -- http://vim.sf.net -- ftp://ftp.vim.org/pub/vim ))) \\\ Help me helping AIDS orphans in Uganda - http://iccf-holland.org ///