comparison src/syntax.c @ 25521:2063b858cad9 v8.2.3297

patch 8.2.3297: cannot use all commands inside a {} block Commit: https://github.com/vim/vim/commit/63b9173693015b135aad8e3657bef5e7f776787e Author: Bram Moolenaar <Bram@vim.org> Date: Thu Aug 5 20:40:03 2021 +0200 patch 8.2.3297: cannot use all commands inside a {} block Problem: Cannot use all commands inside a {} block after :command and :autocmd. Solution: Do consider \n to separate commands. (closes #8620)
author Bram Moolenaar <Bram@vim.org>
date Thu, 05 Aug 2021 20:45:04 +0200
parents 078edc1821bf
children eaa97adb0732
comparison
equal deleted inserted replaced
25520:619be3af2a4e 25521:2063b858cad9
3787 * It actually resets highlighting, not syntax. 3787 * It actually resets highlighting, not syntax.
3788 */ 3788 */
3789 static void 3789 static void
3790 syn_cmd_reset(exarg_T *eap, int syncing UNUSED) 3790 syn_cmd_reset(exarg_T *eap, int syncing UNUSED)
3791 { 3791 {
3792 eap->nextcmd = check_nextcmd(eap->arg); 3792 set_nextcmd(eap, eap->arg);
3793 if (!eap->skip) 3793 if (!eap->skip)
3794 { 3794 {
3795 set_internal_string_var((char_u *)"syntax_cmd", (char_u *)"reset"); 3795 set_internal_string_var((char_u *)"syntax_cmd", (char_u *)"reset");
3796 do_cmdline_cmd((char_u *)"runtime! syntax/syncolor.vim"); 3796 do_cmdline_cmd((char_u *)"runtime! syntax/syncolor.vim");
3797 do_unlet((char_u *)"g:syntax_cmd", TRUE); 3797 do_unlet((char_u *)"g:syntax_cmd", TRUE);
3819 static void 3819 static void
3820 syn_cmd_onoff(exarg_T *eap, char *name) 3820 syn_cmd_onoff(exarg_T *eap, char *name)
3821 { 3821 {
3822 char_u buf[100]; 3822 char_u buf[100];
3823 3823
3824 eap->nextcmd = check_nextcmd(eap->arg); 3824 set_nextcmd(eap, eap->arg);
3825 if (!eap->skip) 3825 if (!eap->skip)
3826 { 3826 {
3827 STRCPY(buf, "so "); 3827 STRCPY(buf, "so ");
3828 vim_snprintf((char *)buf + 3, sizeof(buf) - 3, SYNTAX_FNAME, name); 3828 vim_snprintf((char *)buf + 3, sizeof(buf) - 3, SYNTAX_FNAME, name);
3829 do_cmdline_cmd(buf); 3829 do_cmdline_cmd(buf);
3926 syn_list_one(id, syncing, TRUE); 3926 syn_list_one(id, syncing, TRUE);
3927 } 3927 }
3928 arg = skipwhite(arg_end); 3928 arg = skipwhite(arg_end);
3929 } 3929 }
3930 } 3930 }
3931 eap->nextcmd = check_nextcmd(arg); 3931 set_nextcmd(eap, arg);
3932 } 3932 }
3933 3933
3934 static void 3934 static void
3935 syn_lines_msg(void) 3935 syn_lines_msg(void)
3936 { 3936 {
4919 vim_free(syn_opt_arg.next_list); 4919 vim_free(syn_opt_arg.next_list);
4920 } 4920 }
4921 } 4921 }
4922 4922
4923 if (rest != NULL) 4923 if (rest != NULL)
4924 eap->nextcmd = check_nextcmd(rest); 4924 set_nextcmd(eap, rest);
4925 else 4925 else
4926 semsg(_(e_invarg2), arg); 4926 semsg(_(e_invarg2), arg);
4927 4927
4928 redraw_curbuf_later(SOME_VALID); 4928 redraw_curbuf_later(SOME_VALID);
4929 syn_stack_free_all(curwin->w_s); // Need to recompute all syntax. 4929 syn_stack_free_all(curwin->w_s); // Need to recompute all syntax.
4976 if (rest != NULL) // all arguments are valid 4976 if (rest != NULL) // all arguments are valid
4977 { 4977 {
4978 /* 4978 /*
4979 * Check for trailing command and illegal trailing arguments. 4979 * Check for trailing command and illegal trailing arguments.
4980 */ 4980 */
4981 eap->nextcmd = check_nextcmd(rest); 4981 set_nextcmd(eap, rest);
4982 if (!ends_excmd2(eap->cmd, rest) || eap->skip) 4982 if (!ends_excmd2(eap->cmd, rest) || eap->skip)
4983 rest = NULL; 4983 rest = NULL;
4984 else if (ga_grow(&curwin->w_s->b_syn_patterns, 1) != FAIL 4984 else if (ga_grow(&curwin->w_s->b_syn_patterns, 1) != FAIL
4985 && (syn_id = syn_check_group(arg, 4985 && (syn_id = syn_check_group(arg,
4986 (int)(group_name_end - arg))) != 0) 4986 (int)(group_name_end - arg))) != 0)
5216 { 5216 {
5217 /* 5217 /*
5218 * Check for trailing garbage or command. 5218 * Check for trailing garbage or command.
5219 * If OK, add the item. 5219 * If OK, add the item.
5220 */ 5220 */
5221 eap->nextcmd = check_nextcmd(rest); 5221 set_nextcmd(eap, rest);
5222 if (!ends_excmd(*rest) || eap->skip) 5222 if (!ends_excmd(*rest) || eap->skip)
5223 rest = NULL; 5223 rest = NULL;
5224 else if (ga_grow(&(curwin->w_s->b_syn_patterns), pat_count) != FAIL 5224 else if (ga_grow(&(curwin->w_s->b_syn_patterns), pat_count) != FAIL
5225 && (syn_id = syn_check_group(arg, 5225 && (syn_id = syn_check_group(arg,
5226 (int)(group_name_end - arg))) != 0) 5226 (int)(group_name_end - arg))) != 0)
5894 vim_free(key); 5894 vim_free(key);
5895 if (illegal) 5895 if (illegal)
5896 semsg(_("E404: Illegal arguments: %s"), arg_start); 5896 semsg(_("E404: Illegal arguments: %s"), arg_start);
5897 else if (!finished) 5897 else if (!finished)
5898 { 5898 {
5899 eap->nextcmd = check_nextcmd(arg_start); 5899 set_nextcmd(eap, arg_start);
5900 redraw_curbuf_later(SOME_VALID); 5900 redraw_curbuf_later(SOME_VALID);
5901 syn_stack_free_all(curwin->w_s); // Need to recompute all syntax. 5901 syn_stack_free_all(curwin->w_s); // Need to recompute all syntax.
5902 } 5902 }
5903 } 5903 }
5904 5904