To: vim-dev@vim.org Subject: Patch 6.0.068 Fcc: outbox From: Bram Moolenaar MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit ------------ Patch 6.0.068 Problem: When formatting a Visually selected area with "gq" and the number of lines increases the last line may not be redrawn correctly. (Yegappan Lakshmanan) Solution: Correct the area to be redrawn for inserted/deleted lines. Files: src/ops.c *** ../vim60.67/src/ops.c Wed Oct 31 20:51:33 2001 --- src/ops.c Sat Nov 3 21:25:47 2001 *************** *** 4034,4043 **** if (oap->end_adjusted && curwin->w_cursor.lnum < curbuf->b_ml.ml_line_count) ++curwin->w_cursor.lnum; beginline(BL_WHITE | BL_FIX); ! msgmore(curbuf->b_ml.ml_line_count - old_line_count); /* put '] mark on the end of the formatted area */ curbuf->b_op_end = curwin->w_cursor; } /* --- 4035,4065 ---- if (oap->end_adjusted && curwin->w_cursor.lnum < curbuf->b_ml.ml_line_count) ++curwin->w_cursor.lnum; beginline(BL_WHITE | BL_FIX); ! old_line_count = curbuf->b_ml.ml_line_count - old_line_count; ! msgmore(old_line_count); /* put '] mark on the end of the formatted area */ curbuf->b_op_end = curwin->w_cursor; + + #ifdef FEAT_VISUAL + if (oap->is_VIsual) + { + win_T *wp; + + FOR_ALL_WINDOWS(wp) + { + if (wp->w_old_cursor_lnum != 0) + { + /* When lines have been inserted or deleted, adjust the end of + * the Visual area to be redrawn. */ + if (wp->w_old_cursor_lnum > wp->w_old_visual_lnum) + wp->w_old_cursor_lnum += old_line_count; + else + wp->w_old_visual_lnum += old_line_count; + } + } + } + #endif } /* *** ../vim60.67/src/version.c Sat Nov 3 14:16:30 2001 --- src/version.c Sat Nov 3 21:28:49 2001 *************** *** 608,609 **** --- 608,611 ---- { /* Add new patch number below this line */ + /**/ + 68, /**/ -- At some point in the project somebody will start whining about the need to determine the project "requirements". This involves interviewing people who don't know what they want but, curiously, know exactly when they need it. (Scott Adams - The Dilbert principle) /// 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 ///