Mercurial > vim
comparison src/vim9execute.c @ 22703:f2bfee4ac356 v8.2.1900
patch 8.2.1900: Vim9: command modifiers do not work
Commit: https://github.com/vim/vim/commit/02194d2bd54eacd0b7b9a017a3fe1702ecb80971
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Oct 24 23:08:38 2020 +0200
patch 8.2.1900: Vim9: command modifiers do not work
Problem: Vim9: command modifiers do not work.
Solution: Make most command modifiers work.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 24 Oct 2020 23:15:04 +0200 |
parents | dda110a14be4 |
children | 8968ed4ba4ba |
comparison
equal
deleted
inserted
replaced
22702:81d7d3860786 | 22703:f2bfee4ac356 |
---|---|
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; | 835 cmdmod_T save_cmdmod; |
836 int save_emsg_silent = -1; | 836 int restore_cmdmod = FALSE; |
837 | 837 |
838 // Get pointer to item in the stack. | 838 // Get pointer to item in the stack. |
839 #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) |
840 | 840 |
841 // 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. |
2814 do_put(regname, expr, dir, 1L, PUT_LINE|PUT_CURSLINE); | 2814 do_put(regname, expr, dir, 1L, PUT_LINE|PUT_CURSLINE); |
2815 vim_free(expr); | 2815 vim_free(expr); |
2816 } | 2816 } |
2817 break; | 2817 break; |
2818 | 2818 |
2819 case ISN_SILENT: | 2819 case ISN_CMDMOD: |
2820 if (save_msg_silent == -1) | 2820 save_cmdmod = cmdmod; |
2821 save_msg_silent = msg_silent; | 2821 restore_cmdmod = TRUE; |
2822 ++msg_silent; | 2822 cmdmod = *iptr->isn_arg.cmdmod.cf_cmdmod; |
2823 if (iptr->isn_arg.number) | 2823 apply_cmdmod(&cmdmod); |
2824 { | 2824 break; |
2825 if (save_emsg_silent == -1) | 2825 |
2826 save_emsg_silent = emsg_silent; | 2826 case ISN_CMDMOD_REV: |
2827 ++emsg_silent; | 2827 // filter regprog is owned by the instruction, don't free it |
2828 } | 2828 cmdmod.cmod_filter_regmatch.regprog = NULL; |
2829 break; | 2829 undo_cmdmod(&cmdmod); |
2830 | 2830 cmdmod = save_cmdmod; |
2831 case ISN_UNSILENT: | 2831 restore_cmdmod = FALSE; |
2832 --msg_silent; | |
2833 if (iptr->isn_arg.number) | |
2834 --emsg_silent; | |
2835 break; | 2832 break; |
2836 | 2833 |
2837 case ISN_SHUFFLE: | 2834 case ISN_SHUFFLE: |
2838 { | 2835 { |
2839 typval_T tmp_tv; | 2836 typval_T tmp_tv; |
2903 | 2900 |
2904 *plist = *msg_list; | 2901 *plist = *msg_list; |
2905 } | 2902 } |
2906 msg_list = saved_msg_list; | 2903 msg_list = saved_msg_list; |
2907 | 2904 |
2908 if (save_msg_silent != -1) | 2905 if (restore_cmdmod) |
2909 msg_silent = save_msg_silent; | 2906 { |
2910 if (save_emsg_silent != -1) | 2907 cmdmod.cmod_filter_regmatch.regprog = NULL; |
2911 emsg_silent = save_emsg_silent; | 2908 undo_cmdmod(&cmdmod); |
2909 cmdmod = save_cmdmod; | |
2910 } | |
2912 | 2911 |
2913 failed_early: | 2912 failed_early: |
2914 // Free all local variables, but not arguments. | 2913 // Free all local variables, but not arguments. |
2915 for (idx = 0; idx < ectx.ec_stack.ga_len; ++idx) | 2914 for (idx = 0; idx < ectx.ec_stack.ga_len; ++idx) |
2916 clear_tv(STACK_TV(idx)); | 2915 clear_tv(STACK_TV(idx)); |
3525 case ISN_PUT: | 3524 case ISN_PUT: |
3526 smsg("%4d PUT %c %ld", current, iptr->isn_arg.put.put_regname, | 3525 smsg("%4d PUT %c %ld", current, iptr->isn_arg.put.put_regname, |
3527 (long)iptr->isn_arg.put.put_lnum); | 3526 (long)iptr->isn_arg.put.put_lnum); |
3528 break; | 3527 break; |
3529 | 3528 |
3530 case ISN_SILENT: smsg("%4d SILENT%s", current, | 3529 // TODO: summarize modifiers |
3531 iptr->isn_arg.number ? "!" : ""); break; | 3530 case ISN_CMDMOD: |
3532 case ISN_UNSILENT: smsg("%4d UNSILENT%s", current, | 3531 { |
3533 iptr->isn_arg.number ? "!" : ""); break; | 3532 char_u *buf; |
3533 int len = produce_cmdmods( | |
3534 NULL, iptr->isn_arg.cmdmod.cf_cmdmod, FALSE); | |
3535 | |
3536 buf = alloc(len + 1); | |
3537 if (buf != NULL) | |
3538 { | |
3539 (void)produce_cmdmods( | |
3540 buf, iptr->isn_arg.cmdmod.cf_cmdmod, FALSE); | |
3541 smsg("%4d CMDMOD %s", current, buf); | |
3542 vim_free(buf); | |
3543 } | |
3544 break; | |
3545 } | |
3546 case ISN_CMDMOD_REV: smsg("%4d CMDMOD_REV", current); break; | |
3534 | 3547 |
3535 case ISN_SHUFFLE: smsg("%4d SHUFFLE %d up %d", current, | 3548 case ISN_SHUFFLE: smsg("%4d SHUFFLE %d up %d", current, |
3536 iptr->isn_arg.shuffle.shfl_item, | 3549 iptr->isn_arg.shuffle.shfl_item, |
3537 iptr->isn_arg.shuffle.shfl_up); | 3550 iptr->isn_arg.shuffle.shfl_up); |
3538 break; | 3551 break; |