vim-patch:7.4.716 #4006

Problem:    When using the 'c' flag of ":substitute" and selecting "a" or "l"
            at the prompt the flags are not remembered for ":&&". (Ingo
            Karkat)
Solution:   Save the flag values and restore them. (Hirohito Higashi)

cad2fc9935
This commit is contained in:
Michael Ennen
2016-01-13 16:37:40 -07:00
committed by Justin M. Keyes
parent 62f1aaedb1
commit c2ab844133
2 changed files with 15 additions and 7 deletions

View File

@@ -2859,6 +2859,8 @@ void do_sub(exarg_T *eap)
static int do_list = FALSE; /* list last line with subs. */ static int do_list = FALSE; /* list last line with subs. */
static int do_number = FALSE; /* list last line with line nr*/ static int do_number = FALSE; /* list last line with line nr*/
static int do_ic = 0; /* ignore case flag */ static int do_ic = 0; /* ignore case flag */
int save_do_all; // remember user specified 'g' flag
int save_do_ask; // remember user specified 'c' flag
char_u *pat = NULL, *sub = NULL; /* init for GCC */ char_u *pat = NULL, *sub = NULL; /* init for GCC */
int delimiter; int delimiter;
int sublen; int sublen;
@@ -3048,12 +3050,14 @@ void do_sub(exarg_T *eap)
break; break;
++cmd; ++cmd;
} }
if (do_count) if (do_count) {
do_ask = FALSE; do_ask = FALSE;
}
/* save_do_all = do_all;
* check for a trailing count save_do_ask = do_ask;
*/
// check for a trailing count
cmd = skipwhite(cmd); cmd = skipwhite(cmd);
if (ascii_isdigit(*cmd)) { if (ascii_isdigit(*cmd)) {
i = getdigits_long(&cmd); i = getdigits_long(&cmd);
@@ -3753,7 +3757,11 @@ skip:
changed_window_setting(); changed_window_setting();
vim_regfree(regmatch.regprog); vim_regfree(regmatch.regprog);
}
// Restore the flag values, they can be used for ":&&".
do_all = save_do_all;
do_ask = save_do_ask;
}
/* /*
* Give message for number of substitutions. * Give message for number of substitutions.

View File

@@ -408,7 +408,7 @@ static int included_patches[] = {
719, 719,
// 718, // 718,
// 717, // 717,
// 716, 716,
715, 715,
714, 714,
713, 713,