To: vim_dev@googlegroups.com Subject: Patch 7.4.199 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 7.4.199 Problem: (issue 197) ]P doesn't paste over Visual selection. Solution: Handle Visual mode specifically. (Christian Brabandt) Files: src/normal.c *** ../vim-7.4.198/src/normal.c 2014-02-23 23:38:58.824760280 +0100 --- src/normal.c 2014-03-12 17:33:28.184831049 +0100 *************** *** 6751,6760 **** { if (!checkclearop(cap->oap)) { prep_redo_cmd(cap); ! do_put(cap->oap->regname, ! (cap->cmdchar == ']' && cap->nchar == 'p') ? FORWARD : BACKWARD, ! cap->count1, PUT_FIXINDENT); } } --- 6751,6808 ---- { if (!checkclearop(cap->oap)) { + int dir = (cap->cmdchar == ']' && cap->nchar == 'p') + ? FORWARD : BACKWARD; + int regname = cap->oap->regname; + #ifdef FEAT_VISUAL + int was_visual = VIsual_active; + int line_count = curbuf->b_ml.ml_line_count; + pos_T start, end; + + if (VIsual_active) + { + start = ltoreq(VIsual, curwin->w_cursor) + ? VIsual : curwin->w_cursor; + end = equalpos(start,VIsual) ? curwin->w_cursor : VIsual; + curwin->w_cursor = (dir == BACKWARD ? start : end); + } + #endif + # ifdef FEAT_CLIPBOARD + adjust_clip_reg(®name); + # endif prep_redo_cmd(cap); ! ! do_put(regname, dir, cap->count1, PUT_FIXINDENT); ! #ifdef FEAT_VISUAL ! if (was_visual) ! { ! VIsual = start; ! curwin->w_cursor = end; ! if (dir == BACKWARD) ! { ! /* adjust lines */ ! VIsual.lnum += curbuf->b_ml.ml_line_count - line_count; ! curwin->w_cursor.lnum += ! curbuf->b_ml.ml_line_count - line_count; ! } ! ! VIsual_active = TRUE; ! if (VIsual_mode == 'V') ! { ! /* delete visually selected lines */ ! cap->cmdchar = 'd'; ! cap->nchar = NUL; ! cap->oap->regname = regname; ! nv_operator(cap); ! do_pending_operator(cap, 0, FALSE); ! } ! if (VIsual_active) ! { ! end_visual_mode(); ! redraw_later(SOME_VALID); ! } ! } ! #endif } } *** ../vim-7.4.198/src/version.c 2014-03-12 17:08:01.508807656 +0100 --- src/version.c 2014-03-12 17:30:36.908828425 +0100 *************** *** 740,741 **** --- 740,743 ---- { /* Add new patch number below this line */ + /**/ + 199, /**/ -- No man may purchase alcohol without written consent from his wife. [real standing law in Pennsylvania, United States of America] /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///