aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorKeerthan Jaic <jckeerthan@gmail.com>2014-04-07 14:11:19 -0400
committerThiago de Arruda <tpadilha84@gmail.com>2014-04-12 16:29:51 -0300
commitd4acb0df2f2f5f8900cd173f8b4c5d0539b8fad9 (patch)
tree04794059aa8d02445718eb2079c86f3c93a3c9d8 /src
parent69d7e864e9e2b5d3e3dbb4004e13dcad616a7aca (diff)
downloadrneovim-d4acb0df2f2f5f8900cd173f8b4c5d0539b8fad9.tar.gz
rneovim-d4acb0df2f2f5f8900cd173f8b4c5d0539b8fad9.tar.bz2
rneovim-d4acb0df2f2f5f8900cd173f8b4c5d0539b8fad9.zip
vim-patch 7.4.199
Problem: ]P doesn't paste over Visual selection. Solution: Handle Visual mode specifically. (Christian Brabandt) https://code.google.com/p/vim/source/detail?r=54b1a90c937380195fad6a52408aa3b4eed6d8d1
Diffstat (limited to 'src')
-rw-r--r--src/normal.c38
-rw-r--r--src/version.c6
2 files changed, 41 insertions, 3 deletions
diff --git a/src/normal.c b/src/normal.c
index ca5a0d912a..6aab7a9d3d 100644
--- a/src/normal.c
+++ b/src/normal.c
@@ -5248,10 +5248,42 @@ static void nv_brackets(cmdarg_T *cap)
*/
else if (cap->nchar == 'p' || cap->nchar == 'P') {
if (!checkclearop(cap->oap)) {
+ int dir = (cap->cmdchar == ']' && cap->nchar == 'p') ? FORWARD : BACKWARD;
+ int regname = cap->oap->regname;
+ 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);
+ }
prep_redo_cmd(cap);
- do_put(cap->oap->regname,
- (cap->cmdchar == ']' && cap->nchar == 'p') ? FORWARD : BACKWARD,
- cap->count1, PUT_FIXINDENT);
+ do_put(regname, dir, cap->count1, PUT_FIXINDENT);
+ 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);
+ }
+ }
}
}
/*
diff --git a/src/version.c b/src/version.c
index a716ff5082..6aa775f005 100644
--- a/src/version.c
+++ b/src/version.c
@@ -202,6 +202,12 @@ static char *(features[]) = {
static int included_patches[] = {
// Add new patch number below this line
+ 199,
+ //198,
+ //197,
+ //196,
+ //195,
+ //194,
192,
//191,
//190,