diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/normal.c | 54 | ||||
-rw-r--r-- | src/version.c | 2 |
2 files changed, 53 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(®name); +# 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 } } diff --git a/src/version.c b/src/version.c index 3a1070c53..2fe98b8bc 100644 --- a/src/version.c +++ b/src/version.c @@ -739,6 +739,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 199, +/**/ 198, /**/ 197, |