summaryrefslogtreecommitdiff
path: root/src/normal.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2014-03-12 17:42:04 +0100
committerBram Moolenaar <Bram@vim.org>2014-03-12 17:42:04 +0100
commit27bed20452ad2f8a9c9d749d2db20660c3d0e45a (patch)
treedaf211eb0dd03a4b9a841384c4bdaf006b74860f /src/normal.c
parentd8619997c47557a5f8acd52fcab04cd3eb01a0d6 (diff)
downloadvim-git-27bed20452ad2f8a9c9d749d2db20660c3d0e45a.tar.gz
updated for version 7.4.199v7.4.199
Problem: (issue 197) ]P doesn't paste over Visual selection. Solution: Handle Visual mode specifically. (Christian Brabandt)
Diffstat (limited to 'src/normal.c')
-rw-r--r--src/normal.c54
1 files changed, 51 insertions, 3 deletions
diff --git a/src/normal.c b/src/normal.c
index b8c6fc24f..19025f75b 100644
--- a/src/normal.c
+++ b/src/normal.c
@@ -6751,10 +6751,58 @@ nv_brackets(cap)
{
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(&regname);
+# endif
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);
+#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
}
}