comparison src/ex_docmd.c @ 21172:96ae8622cfb6 v8.2.1137

patch 8.2.1137: Vim9: modifiers not cleared after compiling function Commit: https://github.com/vim/vim/commit/47e7d70b58e8bfc1daaf6d35569ef2dbd0339ddc Author: Bram Moolenaar <Bram@vim.org> Date: Sun Jul 5 18:18:42 2020 +0200 patch 8.2.1137: Vim9: modifiers not cleared after compiling function Problem: Vim9: modifiers not cleared after compiling function. Solution: Clear command modifiers. (closes https://github.com/vim/vim/issues/6396)
author Bram Moolenaar <Bram@vim.org>
date Sun, 05 Jul 2020 18:30:07 +0200
parents 4a1e8086759b
children 874a28fac941
comparison
equal deleted inserted replaced
21171:0472770ff04e 21172:96ae8622cfb6
23 static char_u *do_one_cmd(char_u **, int, cstack_T *, char_u *(*fgetline)(int, void *, int, int), void *cookie); 23 static char_u *do_one_cmd(char_u **, int, cstack_T *, char_u *(*fgetline)(int, void *, int, int), void *cookie);
24 #else 24 #else
25 static char_u *do_one_cmd(char_u **, int, char_u *(*fgetline)(int, void *, int, int), void *cookie); 25 static char_u *do_one_cmd(char_u **, int, char_u *(*fgetline)(int, void *, int, int), void *cookie);
26 static int if_level = 0; // depth in :if 26 static int if_level = 0; // depth in :if
27 #endif 27 #endif
28 static void free_cmdmod(void);
29 static void append_command(char_u *cmd); 28 static void append_command(char_u *cmd);
30 29
31 #ifndef FEAT_MENU 30 #ifndef FEAT_MENU
32 # define ex_emenu ex_ni 31 # define ex_emenu ex_ni
33 # define ex_menu ex_ni 32 # define ex_menu ex_ni
2609 do_errthrow(cstack, 2608 do_errthrow(cstack,
2610 (ea.cmdidx != CMD_SIZE && !IS_USER_CMDIDX(ea.cmdidx)) 2609 (ea.cmdidx != CMD_SIZE && !IS_USER_CMDIDX(ea.cmdidx))
2611 ? cmdnames[(int)ea.cmdidx].cmd_name : (char_u *)NULL); 2610 ? cmdnames[(int)ea.cmdidx].cmd_name : (char_u *)NULL);
2612 #endif 2611 #endif
2613 2612
2614 if (ea.verbose_save >= 0) 2613 undo_cmdmod(&ea, save_msg_scroll);
2615 p_verbose = ea.verbose_save;
2616
2617 free_cmdmod();
2618 cmdmod = save_cmdmod; 2614 cmdmod = save_cmdmod;
2619 reg_executing = save_reg_executing; 2615 reg_executing = save_reg_executing;
2620
2621 if (ea.save_msg_silent != -1)
2622 {
2623 // messages could be enabled for a serious error, need to check if the
2624 // counters don't become negative
2625 if (!did_emsg || msg_silent > ea.save_msg_silent)
2626 msg_silent = ea.save_msg_silent;
2627 emsg_silent -= ea.did_esilent;
2628 if (emsg_silent < 0)
2629 emsg_silent = 0;
2630 // Restore msg_scroll, it's set by file I/O commands, even when no
2631 // message is actually displayed.
2632 msg_scroll = save_msg_scroll;
2633
2634 // "silent reg" or "silent echo x" inside "redir" leaves msg_col
2635 // somewhere in the line. Put it back in the first column.
2636 if (redirecting())
2637 msg_col = 0;
2638 }
2639 2616
2640 #ifdef HAVE_SANDBOX 2617 #ifdef HAVE_SANDBOX
2641 if (ea.did_sandbox) 2618 if (ea.did_sandbox)
2642 --sandbox; 2619 --sandbox;
2643 #endif 2620 #endif
2925 2902
2926 return OK; 2903 return OK;
2927 } 2904 }
2928 2905
2929 /* 2906 /*
2930 * Free contents of "cmdmod". 2907 * Unod and free contents of "cmdmod".
2931 */ 2908 */
2932 static void 2909 void
2933 free_cmdmod(void) 2910 undo_cmdmod(exarg_T *eap, int save_msg_scroll)
2934 { 2911 {
2912 if (eap->verbose_save >= 0)
2913 p_verbose = eap->verbose_save;
2914
2935 if (cmdmod.save_ei != NULL) 2915 if (cmdmod.save_ei != NULL)
2936 { 2916 {
2937 // Restore 'eventignore' to the value before ":noautocmd". 2917 // Restore 'eventignore' to the value before ":noautocmd".
2938 set_string_option_direct((char_u *)"ei", -1, cmdmod.save_ei, 2918 set_string_option_direct((char_u *)"ei", -1, cmdmod.save_ei,
2939 OPT_FREE, SID_NONE); 2919 OPT_FREE, SID_NONE);
2940 free_string_option(cmdmod.save_ei); 2920 free_string_option(cmdmod.save_ei);
2941 } 2921 }
2942 2922
2943 if (cmdmod.filter_regmatch.regprog != NULL) 2923 if (cmdmod.filter_regmatch.regprog != NULL)
2944 vim_regfree(cmdmod.filter_regmatch.regprog); 2924 vim_regfree(cmdmod.filter_regmatch.regprog);
2925
2926 if (eap->save_msg_silent != -1)
2927 {
2928 // messages could be enabled for a serious error, need to check if the
2929 // counters don't become negative
2930 if (!did_emsg || msg_silent > eap->save_msg_silent)
2931 msg_silent = eap->save_msg_silent;
2932 emsg_silent -= eap->did_esilent;
2933 if (emsg_silent < 0)
2934 emsg_silent = 0;
2935 // Restore msg_scroll, it's set by file I/O commands, even when no
2936 // message is actually displayed.
2937 msg_scroll = save_msg_scroll;
2938
2939 // "silent reg" or "silent echo x" inside "redir" leaves msg_col
2940 // somewhere in the line. Put it back in the first column.
2941 if (redirecting())
2942 msg_col = 0;
2943 }
2945 } 2944 }
2946 2945
2947 /* 2946 /*
2948 * Parse the address range, if any, in "eap". 2947 * Parse the address range, if any, in "eap".
2949 * May set the last search pattern, unless "silent" is TRUE. 2948 * May set the last search pattern, unless "silent" is TRUE.