To: vim-dev@vim.org Subject: Patch 6.0.187 Fcc: outbox From: Bram Moolenaar MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit ------------ Patch 6.0.187 Problem: "I" in Visual mode and then "u" reports too many changes. (Andrew Stryker) "I" in Visual linewise mode adjusts the indent for no apparent reason. Solution: Only save those lines for undo that are changed. Don't change the indent after inserting in Visual linewise mode. Files: src/ops.c *** ../vim60.186/src/ops.c Mon Feb 4 12:54:37 2002 --- src/ops.c Tue Feb 5 21:31:39 2002 *************** *** 509,514 **** --- 509,515 ---- #ifdef FEAT_VISUALEXTRA /* * Insert string "s" (b_insert ? before : after) block :AKelly + * Caller must prepare for undo. */ static void block_insert(oap, s, b_insert, bdp) *************** *** 2098,2107 **** struct block_def bd; int i; - if (u_save((linenr_T)(oap->start.lnum - 1), - (linenr_T)(oap->end.lnum + 1)) == FAIL) - return; - /* edit() changes this - record it for OP_APPEND */ bd.is_MAX = (curwin->w_curswant == MAXCOL); --- 2099,2104 ---- *************** *** 2121,2126 **** --- 2118,2125 ---- int old_ve_flags = ve_flags; ve_flags = VE_ALL; + if (u_save_cursor() == FAIL) + return; coladvance_force(oap->op_type == OP_APPEND ? oap->end_vcol + 1 : getviscol()); if (oap->op_type == OP_APPEND) *************** *** 2153,2158 **** --- 2152,2159 ---- { /* First line was too short, make it longer and adjust the * values in "bd". */ + if (u_save_cursor() == FAIL) + return; for (i = 0; i < bd.endspaces; ++i) ins_char(' '); bd.textlen += bd.endspaces; *************** *** 2176,2182 **** if (curwin->w_cursor.lnum != oap->start.lnum) return; - if (oap->block_mode) { struct block_def bd2; --- 2177,2182 ---- *************** *** 2212,2230 **** if (ins_text != NULL) { /* block handled here */ ! block_insert(oap, ins_text, (oap->op_type == OP_INSERT), &bd); curwin->w_cursor.col = oap->start.col; check_cursor(); } - vim_free(ins_text); } } - - #if defined(FEAT_LISP) || defined(FEAT_CINDENT) - if (oap->motion_type == MLINE) - fix_indent(); - #endif } #endif --- 2212,2228 ---- if (ins_text != NULL) { /* block handled here */ ! if (u_save(oap->start.lnum, ! (linenr_T)(oap->end.lnum + 1)) == OK) ! block_insert(oap, ins_text, (oap->op_type == OP_INSERT), ! &bd); curwin->w_cursor.col = oap->start.col; check_cursor(); + vim_free(ins_text); } } } } #endif *** ../vim60.186/src/version.c Tue Feb 5 13:38:48 2002 --- src/version.c Tue Feb 5 21:36:27 2002 *************** *** 608,609 **** --- 608,611 ---- { /* Add new patch number below this line */ + /**/ + 187, /**/ -- hundred-and-one symptoms of being an internet addict: 234. You started college as a chemistry major, and walk out four years later as an Internet provider. /// 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 ///