comparison src/vim9execute.c @ 22691:dda110a14be4 v8.2.1894

patch 8.2.1894: Vim9: command modifiers are not supported Commit: https://github.com/vim/vim/commit/f4c6e1e75c2a7f2ca3a7f4529e7da31dc98557e9 Author: Bram Moolenaar <Bram@vim.org> Date: Fri Oct 23 18:02:32 2020 +0200 patch 8.2.1894: Vim9: command modifiers are not supported Problem: Vim9: command modifiers are not supported. Solution: Support "silent" and "silent!".
author Bram Moolenaar <Bram@vim.org>
date Fri, 23 Oct 2020 18:15:03 +0200
parents 6dce588f7a46
children f2bfee4ac356
comparison
equal deleted inserted replaced
22690:3b5c9b442a73 22691:dda110a14be4
830 int breakcheck_count = 0; 830 int breakcheck_count = 0;
831 int called_emsg_before = called_emsg; 831 int called_emsg_before = called_emsg;
832 int save_suppress_errthrow = suppress_errthrow; 832 int save_suppress_errthrow = suppress_errthrow;
833 msglist_T **saved_msg_list = NULL; 833 msglist_T **saved_msg_list = NULL;
834 msglist_T *private_msg_list = NULL; 834 msglist_T *private_msg_list = NULL;
835 int save_msg_silent = -1;
836 int save_emsg_silent = -1;
835 837
836 // Get pointer to item in the stack. 838 // Get pointer to item in the stack.
837 #define STACK_TV(idx) (((typval_T *)ectx.ec_stack.ga_data) + idx) 839 #define STACK_TV(idx) (((typval_T *)ectx.ec_stack.ga_data) + idx)
838 840
839 // Get pointer to item at the bottom of the stack, -1 is the bottom. 841 // Get pointer to item at the bottom of the stack, -1 is the bottom.
2812 do_put(regname, expr, dir, 1L, PUT_LINE|PUT_CURSLINE); 2814 do_put(regname, expr, dir, 1L, PUT_LINE|PUT_CURSLINE);
2813 vim_free(expr); 2815 vim_free(expr);
2814 } 2816 }
2815 break; 2817 break;
2816 2818
2819 case ISN_SILENT:
2820 if (save_msg_silent == -1)
2821 save_msg_silent = msg_silent;
2822 ++msg_silent;
2823 if (iptr->isn_arg.number)
2824 {
2825 if (save_emsg_silent == -1)
2826 save_emsg_silent = emsg_silent;
2827 ++emsg_silent;
2828 }
2829 break;
2830
2831 case ISN_UNSILENT:
2832 --msg_silent;
2833 if (iptr->isn_arg.number)
2834 --emsg_silent;
2835 break;
2836
2817 case ISN_SHUFFLE: 2837 case ISN_SHUFFLE:
2818 { 2838 {
2819 typval_T tmp_tv; 2839 typval_T tmp_tv;
2820 int item = iptr->isn_arg.shuffle.shfl_item; 2840 int item = iptr->isn_arg.shuffle.shfl_item;
2821 int up = iptr->isn_arg.shuffle.shfl_up; 2841 int up = iptr->isn_arg.shuffle.shfl_up;
2882 plist = &(*plist)->next; 2902 plist = &(*plist)->next;
2883 2903
2884 *plist = *msg_list; 2904 *plist = *msg_list;
2885 } 2905 }
2886 msg_list = saved_msg_list; 2906 msg_list = saved_msg_list;
2907
2908 if (save_msg_silent != -1)
2909 msg_silent = save_msg_silent;
2910 if (save_emsg_silent != -1)
2911 emsg_silent = save_emsg_silent;
2887 2912
2888 failed_early: 2913 failed_early:
2889 // Free all local variables, but not arguments. 2914 // Free all local variables, but not arguments.
2890 for (idx = 0; idx < ectx.ec_stack.ga_len; ++idx) 2915 for (idx = 0; idx < ectx.ec_stack.ga_len; ++idx)
2891 clear_tv(STACK_TV(idx)); 2916 clear_tv(STACK_TV(idx));
3499 break; 3524 break;
3500 case ISN_PUT: 3525 case ISN_PUT:
3501 smsg("%4d PUT %c %ld", current, iptr->isn_arg.put.put_regname, 3526 smsg("%4d PUT %c %ld", current, iptr->isn_arg.put.put_regname,
3502 (long)iptr->isn_arg.put.put_lnum); 3527 (long)iptr->isn_arg.put.put_lnum);
3503 break; 3528 break;
3529
3530 case ISN_SILENT: smsg("%4d SILENT%s", current,
3531 iptr->isn_arg.number ? "!" : ""); break;
3532 case ISN_UNSILENT: smsg("%4d UNSILENT%s", current,
3533 iptr->isn_arg.number ? "!" : ""); break;
3504 3534
3505 case ISN_SHUFFLE: smsg("%4d SHUFFLE %d up %d", current, 3535 case ISN_SHUFFLE: smsg("%4d SHUFFLE %d up %d", current,
3506 iptr->isn_arg.shuffle.shfl_item, 3536 iptr->isn_arg.shuffle.shfl_item,
3507 iptr->isn_arg.shuffle.shfl_up); 3537 iptr->isn_arg.shuffle.shfl_up);
3508 break; 3538 break;