Mercurial > vim
comparison src/normal.c @ 5708:54b1a90c9373 v7.4.199
updated for version 7.4.199
Problem: (issue 197) ]P doesn't paste over Visual selection.
Solution: Handle Visual mode specifically. (Christian Brabandt)
author | Bram Moolenaar <bram@vim.org> |
---|---|
date | Wed, 12 Mar 2014 17:42:04 +0100 |
parents | 40f18a1c1592 |
children | 50dbef5e774a |
comparison
equal
deleted
inserted
replaced
5707:4a2eb932118b | 5708:54b1a90c9373 |
---|---|
6749 */ | 6749 */ |
6750 else if (cap->nchar == 'p' || cap->nchar == 'P') | 6750 else if (cap->nchar == 'p' || cap->nchar == 'P') |
6751 { | 6751 { |
6752 if (!checkclearop(cap->oap)) | 6752 if (!checkclearop(cap->oap)) |
6753 { | 6753 { |
6754 int dir = (cap->cmdchar == ']' && cap->nchar == 'p') | |
6755 ? FORWARD : BACKWARD; | |
6756 int regname = cap->oap->regname; | |
6757 #ifdef FEAT_VISUAL | |
6758 int was_visual = VIsual_active; | |
6759 int line_count = curbuf->b_ml.ml_line_count; | |
6760 pos_T start, end; | |
6761 | |
6762 if (VIsual_active) | |
6763 { | |
6764 start = ltoreq(VIsual, curwin->w_cursor) | |
6765 ? VIsual : curwin->w_cursor; | |
6766 end = equalpos(start,VIsual) ? curwin->w_cursor : VIsual; | |
6767 curwin->w_cursor = (dir == BACKWARD ? start : end); | |
6768 } | |
6769 #endif | |
6770 # ifdef FEAT_CLIPBOARD | |
6771 adjust_clip_reg(®name); | |
6772 # endif | |
6754 prep_redo_cmd(cap); | 6773 prep_redo_cmd(cap); |
6755 do_put(cap->oap->regname, | 6774 |
6756 (cap->cmdchar == ']' && cap->nchar == 'p') ? FORWARD : BACKWARD, | 6775 do_put(regname, dir, cap->count1, PUT_FIXINDENT); |
6757 cap->count1, PUT_FIXINDENT); | 6776 #ifdef FEAT_VISUAL |
6777 if (was_visual) | |
6778 { | |
6779 VIsual = start; | |
6780 curwin->w_cursor = end; | |
6781 if (dir == BACKWARD) | |
6782 { | |
6783 /* adjust lines */ | |
6784 VIsual.lnum += curbuf->b_ml.ml_line_count - line_count; | |
6785 curwin->w_cursor.lnum += | |
6786 curbuf->b_ml.ml_line_count - line_count; | |
6787 } | |
6788 | |
6789 VIsual_active = TRUE; | |
6790 if (VIsual_mode == 'V') | |
6791 { | |
6792 /* delete visually selected lines */ | |
6793 cap->cmdchar = 'd'; | |
6794 cap->nchar = NUL; | |
6795 cap->oap->regname = regname; | |
6796 nv_operator(cap); | |
6797 do_pending_operator(cap, 0, FALSE); | |
6798 } | |
6799 if (VIsual_active) | |
6800 { | |
6801 end_visual_mode(); | |
6802 redraw_later(SOME_VALID); | |
6803 } | |
6804 } | |
6805 #endif | |
6758 } | 6806 } |
6759 } | 6807 } |
6760 | 6808 |
6761 /* | 6809 /* |
6762 * "['", "[`", "]'" and "]`": jump to next mark | 6810 * "['", "[`", "]'" and "]`": jump to next mark |