Mercurial > vim
comparison src/normal.c @ 4213:0a3fab86f34d v7.3.858
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)
author | Bram Moolenaar <bram@vim.org> |
---|---|
date | Wed, 13 Mar 2013 19:02:41 +0100 |
parents | b97109760603 |
children | dd4f3ceb5d86 |
comparison
equal
deleted
inserted
replaced
4212:fea0acfe0575 | 4213:0a3fab86f34d |
---|---|
19 * The Visual area is remembered for reselection. | 19 * The Visual area is remembered for reselection. |
20 */ | 20 */ |
21 static int resel_VIsual_mode = NUL; /* 'v', 'V', or Ctrl-V */ | 21 static int resel_VIsual_mode = NUL; /* 'v', 'V', or Ctrl-V */ |
22 static linenr_T resel_VIsual_line_count; /* number of lines */ | 22 static linenr_T resel_VIsual_line_count; /* number of lines */ |
23 static colnr_T resel_VIsual_vcol; /* nr of cols or end col */ | 23 static colnr_T resel_VIsual_vcol; /* nr of cols or end col */ |
24 static int VIsual_mode_orig = NUL; /* type of Visual mode, that user entered */ | |
24 | 25 |
25 static int restart_VIsual_select = 0; | 26 static int restart_VIsual_select = 0; |
26 #endif | 27 #endif |
27 | 28 |
28 #ifdef FEAT_EVAL | 29 #ifdef FEAT_EVAL |
1592 { | 1593 { |
1593 /* Save the current VIsual area for '< and '> marks, and "gv" */ | 1594 /* Save the current VIsual area for '< and '> marks, and "gv" */ |
1594 curbuf->b_visual.vi_start = VIsual; | 1595 curbuf->b_visual.vi_start = VIsual; |
1595 curbuf->b_visual.vi_end = curwin->w_cursor; | 1596 curbuf->b_visual.vi_end = curwin->w_cursor; |
1596 curbuf->b_visual.vi_mode = VIsual_mode; | 1597 curbuf->b_visual.vi_mode = VIsual_mode; |
1598 if (VIsual_mode_orig != NUL) | |
1599 { | |
1600 curbuf->b_visual.vi_mode = VIsual_mode_orig; | |
1601 VIsual_mode_orig = NUL; | |
1602 } | |
1597 curbuf->b_visual.vi_curswant = curwin->w_curswant; | 1603 curbuf->b_visual.vi_curswant = curwin->w_curswant; |
1598 # ifdef FEAT_EVAL | 1604 # ifdef FEAT_EVAL |
1599 curbuf->b_visual_mode_eval = VIsual_mode; | 1605 curbuf->b_visual_mode_eval = VIsual_mode; |
1600 # endif | 1606 # endif |
1601 } | 1607 } |
7228 #ifdef FEAT_VISUAL | 7234 #ifdef FEAT_VISUAL |
7229 if (VIsual_active) /* "R" is replace lines */ | 7235 if (VIsual_active) /* "R" is replace lines */ |
7230 { | 7236 { |
7231 cap->cmdchar = 'c'; | 7237 cap->cmdchar = 'c'; |
7232 cap->nchar = NUL; | 7238 cap->nchar = NUL; |
7239 VIsual_mode_orig = VIsual_mode; /* remember original area for gv */ | |
7233 VIsual_mode = 'V'; | 7240 VIsual_mode = 'V'; |
7234 nv_operator(cap); | 7241 nv_operator(cap); |
7235 } | 7242 } |
7236 else | 7243 else |
7237 #endif | 7244 #endif |
7427 /* Uppercase means linewise, except in block mode, then "D" deletes till | 7434 /* Uppercase means linewise, except in block mode, then "D" deletes till |
7428 * the end of the line, and "C" replaces til EOL */ | 7435 * the end of the line, and "C" replaces til EOL */ |
7429 if (isupper(cap->cmdchar)) | 7436 if (isupper(cap->cmdchar)) |
7430 { | 7437 { |
7431 if (VIsual_mode != Ctrl_V) | 7438 if (VIsual_mode != Ctrl_V) |
7439 { | |
7440 VIsual_mode_orig = VIsual_mode; | |
7432 VIsual_mode = 'V'; | 7441 VIsual_mode = 'V'; |
7442 } | |
7433 else if (cap->cmdchar == 'C' || cap->cmdchar == 'D') | 7443 else if (cap->cmdchar == 'C' || cap->cmdchar == 'D') |
7434 curwin->w_curswant = MAXCOL; | 7444 curwin->w_curswant = MAXCOL; |
7435 } | 7445 } |
7436 cap->cmdchar = *(vim_strchr(trans, cap->cmdchar) + 1); | 7446 cap->cmdchar = *(vim_strchr(trans, cap->cmdchar) + 1); |
7437 nv_operator(cap); | 7447 nv_operator(cap); |
7447 { | 7457 { |
7448 #ifdef FEAT_VISUAL | 7458 #ifdef FEAT_VISUAL |
7449 if (VIsual_active) /* "vs" and "vS" are the same as "vc" */ | 7459 if (VIsual_active) /* "vs" and "vS" are the same as "vc" */ |
7450 { | 7460 { |
7451 if (cap->cmdchar == 'S') | 7461 if (cap->cmdchar == 'S') |
7462 { | |
7463 VIsual_mode_orig = VIsual_mode; | |
7452 VIsual_mode = 'V'; | 7464 VIsual_mode = 'V'; |
7465 } | |
7453 cap->cmdchar = 'c'; | 7466 cap->cmdchar = 'c'; |
7454 nv_operator(cap); | 7467 nv_operator(cap); |
7455 } | 7468 } |
7456 else | 7469 else |
7457 #endif | 7470 #endif |