forked from aniani/vim
updated for version 7.3.858
Problem: "gv" selects the wrong area after some operators. Solution: Save and restore the type of selection. (Christian Brabandt)
This commit is contained in:
13
src/normal.c
13
src/normal.c
@@ -21,6 +21,7 @@
|
|||||||
static int resel_VIsual_mode = NUL; /* 'v', 'V', or Ctrl-V */
|
static int resel_VIsual_mode = NUL; /* 'v', 'V', or Ctrl-V */
|
||||||
static linenr_T resel_VIsual_line_count; /* number of lines */
|
static linenr_T resel_VIsual_line_count; /* number of lines */
|
||||||
static colnr_T resel_VIsual_vcol; /* nr of cols or end col */
|
static colnr_T resel_VIsual_vcol; /* nr of cols or end col */
|
||||||
|
static int VIsual_mode_orig = NUL; /* type of Visual mode, that user entered */
|
||||||
|
|
||||||
static int restart_VIsual_select = 0;
|
static int restart_VIsual_select = 0;
|
||||||
#endif
|
#endif
|
||||||
@@ -1594,6 +1595,11 @@ do_pending_operator(cap, old_col, gui_yank)
|
|||||||
curbuf->b_visual.vi_start = VIsual;
|
curbuf->b_visual.vi_start = VIsual;
|
||||||
curbuf->b_visual.vi_end = curwin->w_cursor;
|
curbuf->b_visual.vi_end = curwin->w_cursor;
|
||||||
curbuf->b_visual.vi_mode = VIsual_mode;
|
curbuf->b_visual.vi_mode = VIsual_mode;
|
||||||
|
if (VIsual_mode_orig != NUL)
|
||||||
|
{
|
||||||
|
curbuf->b_visual.vi_mode = VIsual_mode_orig;
|
||||||
|
VIsual_mode_orig = NUL;
|
||||||
|
}
|
||||||
curbuf->b_visual.vi_curswant = curwin->w_curswant;
|
curbuf->b_visual.vi_curswant = curwin->w_curswant;
|
||||||
# ifdef FEAT_EVAL
|
# ifdef FEAT_EVAL
|
||||||
curbuf->b_visual_mode_eval = VIsual_mode;
|
curbuf->b_visual_mode_eval = VIsual_mode;
|
||||||
@@ -7230,6 +7236,7 @@ nv_Replace(cap)
|
|||||||
{
|
{
|
||||||
cap->cmdchar = 'c';
|
cap->cmdchar = 'c';
|
||||||
cap->nchar = NUL;
|
cap->nchar = NUL;
|
||||||
|
VIsual_mode_orig = VIsual_mode; /* remember original area for gv */
|
||||||
VIsual_mode = 'V';
|
VIsual_mode = 'V';
|
||||||
nv_operator(cap);
|
nv_operator(cap);
|
||||||
}
|
}
|
||||||
@@ -7429,7 +7436,10 @@ v_visop(cap)
|
|||||||
if (isupper(cap->cmdchar))
|
if (isupper(cap->cmdchar))
|
||||||
{
|
{
|
||||||
if (VIsual_mode != Ctrl_V)
|
if (VIsual_mode != Ctrl_V)
|
||||||
|
{
|
||||||
|
VIsual_mode_orig = VIsual_mode;
|
||||||
VIsual_mode = 'V';
|
VIsual_mode = 'V';
|
||||||
|
}
|
||||||
else if (cap->cmdchar == 'C' || cap->cmdchar == 'D')
|
else if (cap->cmdchar == 'C' || cap->cmdchar == 'D')
|
||||||
curwin->w_curswant = MAXCOL;
|
curwin->w_curswant = MAXCOL;
|
||||||
}
|
}
|
||||||
@@ -7449,7 +7459,10 @@ nv_subst(cap)
|
|||||||
if (VIsual_active) /* "vs" and "vS" are the same as "vc" */
|
if (VIsual_active) /* "vs" and "vS" are the same as "vc" */
|
||||||
{
|
{
|
||||||
if (cap->cmdchar == 'S')
|
if (cap->cmdchar == 'S')
|
||||||
|
{
|
||||||
|
VIsual_mode_orig = VIsual_mode;
|
||||||
VIsual_mode = 'V';
|
VIsual_mode = 'V';
|
||||||
|
}
|
||||||
cap->cmdchar = 'c';
|
cap->cmdchar = 'c';
|
||||||
nv_operator(cap);
|
nv_operator(cap);
|
||||||
}
|
}
|
||||||
|
@@ -3,12 +3,14 @@ Test for visual block shift and tab characters.
|
|||||||
|
|
||||||
STARTTEST
|
STARTTEST
|
||||||
:so small.vim
|
:so small.vim
|
||||||
|
/^one
|
||||||
|
fe4jRugvr1:'<,'>w! test.out
|
||||||
/^abcdefgh
|
/^abcdefgh
|
||||||
4jI j<<11|D
|
4jI j<<11|D
|
||||||
7|a
|
7|a
|
||||||
7|a
|
7|a
|
||||||
7|a 4k13|4j<
|
7|a 4k13|4j<
|
||||||
:$-4,$w! test.out
|
:$-5,$w >> test.out
|
||||||
:$-4,$s/\s\+//g
|
:$-4,$s/\s\+//g
|
||||||
4kI j<<
|
4kI j<<
|
||||||
7|a
|
7|a
|
||||||
@@ -18,6 +20,12 @@ STARTTEST
|
|||||||
:qa!
|
:qa!
|
||||||
ENDTEST
|
ENDTEST
|
||||||
|
|
||||||
|
one two three
|
||||||
|
one two three
|
||||||
|
one two three
|
||||||
|
one two three
|
||||||
|
one two three
|
||||||
|
|
||||||
abcdefghijklmnopqrstuvwxyz
|
abcdefghijklmnopqrstuvwxyz
|
||||||
abcdefghijklmnopqrstuvwxyz
|
abcdefghijklmnopqrstuvwxyz
|
||||||
abcdefghijklmnopqrstuvwxyz
|
abcdefghijklmnopqrstuvwxyz
|
||||||
|
@@ -1,3 +1,9 @@
|
|||||||
|
on1 two three
|
||||||
|
on1 two three
|
||||||
|
on1 two three
|
||||||
|
on1 two three
|
||||||
|
on1 two three
|
||||||
|
|
||||||
abcdefghijklmnopqrstuvwxyz
|
abcdefghijklmnopqrstuvwxyz
|
||||||
abcdefghij
|
abcdefghij
|
||||||
abc defghijklmnopqrstuvwxyz
|
abc defghijklmnopqrstuvwxyz
|
||||||
|
@@ -728,6 +728,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
858,
|
||||||
/**/
|
/**/
|
||||||
857,
|
857,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user