To: vim-dev@vim.org Subject: Patch 6.0.039 Fcc: outbox From: Bram Moolenaar MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit ------------ Patch 6.0.039 Problem: "gP" leaves the cursor in the wrong position when 'virtualedit' is used. Using "c" in blockwise Visual mode leaves the cursor in a strange position. Solution: For "gP" reset the "coladd" field for the '] mark. For "c" leave the cursor on the last inserted character. Files: src/ops.c *** ../vim60.38/src/ops.c Tue Oct 30 11:19:49 2001 --- src/ops.c Tue Oct 30 14:33:31 2001 *************** *** 2304,2314 **** */ if ((ins_len = (long)STRLEN(firstline) - pre_textlen) > 0) { ! if ((ins_text = alloc_check((unsigned)(ins_len + 1))) != 0) { - /* put cursor at end of changed text */ - curwin->w_cursor = oap->end; - STRNCPY(ins_text, firstline + bd.textcol, ins_len); *(ins_text + ins_len) = NUL; for (linenr = oap->start.lnum + 1; linenr <= oap->end.lnum; --- 2305,2312 ---- */ if ((ins_len = (long)STRLEN(firstline) - pre_textlen) > 0) { ! if ((ins_text = alloc_check((unsigned)(ins_len + 1))) != NULL) { STRNCPY(ins_text, firstline + bd.textcol, ins_len); *(ins_text + ins_len) = NUL; for (linenr = oap->start.lnum + 1; linenr <= oap->end.lnum; *************** *** 2331,2341 **** mch_memmove(newp + bd.textcol + offset, oldp, STRLEN(oldp) + 1); ml_replace(linenr, newp, FALSE); - if (linenr == oap->end.lnum) - curwin->w_cursor.col = bd.textcol + ins_len - 1; } } - curwin->w_cursor.col = oap->start.col; check_cursor(); changed_lines(oap->start.lnum + 1, 0, oap->end.lnum + 1, 0L); --- 2329,2336 ---- *************** *** 3135,3140 **** --- 3130,3138 ---- /* adjust '] mark */ curbuf->b_op_end.lnum = curwin->w_cursor.lnum - 1; curbuf->b_op_end.col = bd.textcol + totlen - 1; + #ifdef FEAT_VIRTUALEDIT + curbuf->b_op_end.coladd = 0; + #endif if (flags & PUT_CURSEND) { curwin->w_cursor = curbuf->b_op_end; *************** *** 3375,3381 **** --- 3373,3385 ---- && gchar_cursor() == NUL && curwin->w_cursor.col && !(restart_edit || (State & INSERT))) + { --curwin->w_cursor.col; + #ifdef FEAT_VIRTUALEDIT + if (ve_flags == VE_ALL) + ++curwin->w_cursor.coladd; + #endif + } } #if defined(FEAT_SMARTINDENT) || defined(FEAT_CINDENT) || defined(PROTO) *** ../vim60.38/src/version.c Tue Oct 30 11:19:49 2001 --- src/version.c Tue Oct 30 14:43:04 2001 *************** *** 608,609 **** --- 608,611 ---- { /* Add new patch number below this line */ + /**/ + 39, /**/ -- BROTHER MAYNARD: Armaments Chapter Two Verses Nine to Twenty One. ANOTHER MONK: And St. Attila raised his hand grenade up on high saying "O Lord bless this thy hand grenade that with it thou mayest blow thine enemies to tiny bits, in thy mercy. "and the Lord did grin and people did feast upon the lambs and sloths and carp and anchovies and orang-utans and breakfast cereals and fruit bats and... BROTHER MAYNARD: Skip a bit brother ... "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD /// 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 ///