To: vim-dev@vim.org Subject: Patch 6.0.224 Fcc: outbox From: Bram Moolenaar MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit ------------ Patch 6.0.224 Problem: When 'sidescroll' and 'sidescrolloff' are set in a narrow window the text may jump left-right and the cursor is displayed in the wrong position. (Aric Blumer) Solution: When there is not enough room, compute the left column for the window to put the cursor in the middle. Files: src/move.c *** ../vim60.223/src/move.c Sun Dec 30 17:25:33 2001 --- src/move.c Sat Feb 16 13:04:10 2002 *************** *** 930,936 **** { int diff; int extra; /* offset for first screen line */ ! int off; int n; int p_lines; int width = 0; --- 930,936 ---- { int diff; int extra; /* offset for first screen line */ ! int off_left, off_right; int n; int p_lines; int width = 0; *************** *** 1024,1047 **** * If we get closer to the edge than 'sidescrolloff', scroll a little * extra */ ! if ((off = (int)startcol - (int)curwin->w_leftcol - p_siso) < 0 ! || (off = (int)endcol ! - (int)(curwin->w_leftcol + W_WIDTH(curwin) - p_siso) ! + 1) > 0) { ! if (off < 0) ! diff = -off; else ! diff = off; ! /* far off, put cursor in middle of window */ ! if (p_ss == 0 || diff >= textwidth / 2) new_leftcol = curwin->w_wcol - extra - textwidth / 2; else { if (diff < p_ss) diff = p_ss; ! if (off < 0) new_leftcol = curwin->w_leftcol - diff; else new_leftcol = curwin->w_leftcol + diff; --- 1024,1048 ---- * If we get closer to the edge than 'sidescrolloff', scroll a little * extra */ ! off_left = (int)startcol - (int)curwin->w_leftcol - p_siso; ! off_right = (int)endcol - (int)(curwin->w_leftcol + W_WIDTH(curwin) ! - p_siso) + 1; ! if (off_left < 0 || off_right > 0) { ! if (off_left < 0) ! diff = -off_left; else ! diff = off_right; ! /* When far off or not enough room on either side, put cursor in ! * middle of window. */ ! if (p_ss == 0 || diff >= textwidth / 2 || off_right >= off_left) new_leftcol = curwin->w_wcol - extra - textwidth / 2; else { if (diff < p_ss) diff = p_ss; ! if (off_left < 0) new_leftcol = curwin->w_leftcol - diff; else new_leftcol = curwin->w_leftcol + diff; *** ../vim60.223/src/version.c Sat Feb 16 11:54:14 2002 --- src/version.c Sat Feb 16 13:05:27 2002 *************** *** 608,609 **** --- 608,611 ---- { /* Add new patch number below this line */ + /**/ + 224, /**/ -- Dogs must have a permit signed by the mayor in order to congregate in groups of three or more on private property. [real standing law in Oklahoma, United States of America] /// Bram Moolenaar -- Bram@moolenaar.net -- http://www.moolenaar.net \\\ /// Creator of Vim -- http://vim.sf.net -- ftp://ftp.vim.org/pub/vim \\\ \\\ Project leader for A-A-P -- http://www.a-a-p.org /// \\\ Help me helping AIDS orphans in Uganda - http://iccf-holland.org ///