0
0
mirror of https://github.com/vim/vim.git synced 2025-07-26 11:04:33 -04:00

patch 8.2.3631: "syntax enable" does not work properly in Vim9 context

Problem:    "syntax enable" does not work properly in Vim9 context.
Solution:   Also handle Vim9 context. (closes #9161)
This commit is contained in:
Bram Moolenaar 2021-11-20 19:50:59 +00:00
parent d85fccdfed
commit c8a9fe541d
3 changed files with 12 additions and 2 deletions

View File

@ -3777,7 +3777,7 @@ syn_cmd_on(exarg_T *eap, int syncing UNUSED)
static void static void
syn_cmd_enable(exarg_T *eap, int syncing UNUSED) syn_cmd_enable(exarg_T *eap, int syncing UNUSED)
{ {
set_internal_string_var((char_u *)"syntax_cmd", (char_u *)"enable"); set_internal_string_var((char_u *)"g:syntax_cmd", (char_u *)"enable");
syn_cmd_onoff(eap, "syntax"); syn_cmd_onoff(eap, "syntax");
do_unlet((char_u *)"g:syntax_cmd", TRUE); do_unlet((char_u *)"g:syntax_cmd", TRUE);
} }
@ -3792,7 +3792,7 @@ syn_cmd_reset(exarg_T *eap, int syncing UNUSED)
set_nextcmd(eap, eap->arg); set_nextcmd(eap, eap->arg);
if (!eap->skip) if (!eap->skip)
{ {
set_internal_string_var((char_u *)"syntax_cmd", (char_u *)"reset"); set_internal_string_var((char_u *)"g:syntax_cmd", (char_u *)"reset");
do_cmdline_cmd((char_u *)"runtime! syntax/syncolor.vim"); do_cmdline_cmd((char_u *)"runtime! syntax/syncolor.vim");
do_unlet((char_u *)"g:syntax_cmd", TRUE); do_unlet((char_u *)"g:syntax_cmd", TRUE);
} }

View File

@ -1581,5 +1581,13 @@ def Test_previewpopup()
set previewpopup& set previewpopup&
enddef enddef
def Test_syntax_enable_clear()
syntax clear
syntax enable
highlight clear String
assert_equal(true, hlget('String')->get(0, {})->get('default', false))
syntax clear
enddef
" vim: ts=8 sw=2 sts=2 expandtab tw=80 fdm=marker " vim: ts=8 sw=2 sts=2 expandtab tw=80 fdm=marker

View File

@ -757,6 +757,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
3631,
/**/ /**/
3630, 3630,
/**/ /**/