To: vim-dev@vim.org Subject: patch 5.5.011 Fcc: outbox From: Bram Moolenaar ------------ Patch 5.5.011 Problem: After "CTRL-V s", the cursor jumps back to the start, while all other operators leave the cursor on the last changed character. (Xiangjiang Ma) Solution: Position cursor on last changed character, if possible. Files: src/ops.c *** ../vim-5.5.10/src/ops.c Wed Sep 22 10:06:29 1999 --- src/ops.c Thu Sep 30 19:26:47 1999 *************** *** 1978,1984 **** * In Visual block mode, handle copying the next text to all lines of the * block. */ ! if (oap->block_mode) { firstline = ml_get(oap->start.lnum); /* --- 1978,1984 ---- * In Visual block mode, handle copying the next text to all lines of the * block. */ ! if (oap->block_mode && oap->start.lnum != oap->end.lnum) { firstline = ml_get(oap->start.lnum); /* *************** *** 1989,1994 **** --- 1989,1997 ---- { 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; *************** *** 2005,2026 **** continue; /* copy up to block start */ mch_memmove(newp, oldp, (size_t)bd.textcol); ! for (offset = 0; offset < ins_len ; offset++) *(newp + bd.textcol + offset) = *(ins_text + offset); oldp += bd.textcol; mch_memmove(newp + bd.textcol + offset, oldp, STRLEN(oldp) + 1); ml_replace(linenr, newp, FALSE); } } ! curwin->w_cursor.col = oap->start.col; ! changed_cline_bef_curs(); /* recompute cursor posn. */ approximate_botline(); /* w_botline may be wrong now */ adjust_cursor(); changed(); ! update_screen(VALID_TO_CURSCHAR); } vim_free(ins_text); } --- 2008,2030 ---- continue; /* copy up to block start */ mch_memmove(newp, oldp, (size_t)bd.textcol); ! for (offset = 0; offset < ins_len; offset++) *(newp + bd.textcol + offset) = *(ins_text + offset); oldp += bd.textcol; 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; } } ! changed_line_abv_curs(); /* recompute cursor posn. */ approximate_botline(); /* w_botline may be wrong now */ adjust_cursor(); changed(); ! update_screen(NOT_VALID); } vim_free(ins_text); } *** ../vim-5.5.10/src/version.c Wed Sep 29 22:31:20 1999 --- src/version.c Thu Sep 30 19:31:34 1999 *************** *** 420,420 **** --- 420,421 ---- { /* Add new patch number below this line */ + 11, -- hundred-and-one symptoms of being an internet addict: 233. You start dreaming about web pages...in html. --/-/---- Bram Moolenaar ---- Bram@moolenaar.net ---- Bram@vim.org ---\-\-- \ \ www.vim.org/iccf www.moolenaar.net www.vim.org / /