0
0
mirror of https://github.com/vim/vim.git synced 2025-09-25 03:54:15 -04:00

updated for version 7.4.199

Problem:    (issue 197) ]P doesn't paste over Visual selection.
Solution:   Handle Visual mode specifically. (Christian Brabandt)
This commit is contained in:
Bram Moolenaar
2014-03-12 17:42:04 +01:00
parent d8619997c4
commit 27bed20452
2 changed files with 53 additions and 3 deletions

View File

@@ -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
}
}

View File

@@ -738,6 +738,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
199,
/**/
198,
/**/