diff src/ex_cmds.c @ 6789:874c953aca49 v7.4.716

patch 7.4.716 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)
author Bram Moolenaar <bram@vim.org>
date Mon, 04 May 2015 10:46:03 +0200
parents b85fcd9b858d
children 58d9f967ae1a
line wrap: on
line diff
--- a/src/ex_cmds.c
+++ b/src/ex_cmds.c
@@ -4279,6 +4279,8 @@ do_sub(eap)
     static int	do_list = FALSE;	/* list last line with subs. */
     static int	do_number = FALSE;	/* list last line with line nr*/
     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 */
     int		delimiter;
     int		sublen;
@@ -4514,6 +4516,9 @@ do_sub(eap)
     if (do_count)
 	do_ask = FALSE;
 
+    save_do_all = do_all;
+    save_do_ask = do_ask;
+
     /*
      * check for a trailing count
      */
@@ -5327,6 +5332,10 @@ outofmem:
 #endif
 
     vim_regfree(regmatch.regprog);
+
+    /* Restore the flag values, they can be used for ":&&". */
+    do_all = save_do_all;
+    do_ask = save_do_ask;
 }
 
 /*