To: vim_dev@googlegroups.com Subject: Patch 9.0.0283 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 9.0.0283 Problem: Cannot complete "syn list @cluster". Solution: Recognize and handle "list @". (Björn Linse, closes #10990) Files: src/syntax.c, src/testdir/test_syntax.vim *** ../vim-9.0.0282/src/syntax.c 2022-08-14 14:16:08.003582142 +0100 --- src/syntax.c 2022-08-26 21:57:43.813263984 +0100 *************** *** 6341,6347 **** EXP_SUBCMD, // expand ":syn" sub-commands EXP_CASE, // expand ":syn case" arguments EXP_SPELL, // expand ":syn spell" arguments ! EXP_SYNC // expand ":syn sync" arguments } expand_what; /* --- 6341,6348 ---- EXP_SUBCMD, // expand ":syn" sub-commands EXP_CASE, // expand ":syn case" arguments EXP_SPELL, // expand ":syn spell" arguments ! EXP_SYNC, // expand ":syn sync" arguments ! EXP_CLUSTER // expand ":syn list @cluster" arguments } expand_what; /* *************** *** 6396,6405 **** expand_what = EXP_SPELL; else if (STRNICMP(arg, "sync", p - arg) == 0) expand_what = EXP_SYNC; ! else if ( STRNICMP(arg, "keyword", p - arg) == 0 || STRNICMP(arg, "region", p - arg) == 0 ! || STRNICMP(arg, "match", p - arg) == 0 ! || STRNICMP(arg, "list", p - arg) == 0) xp->xp_context = EXPAND_HIGHLIGHT; else xp->xp_context = EXPAND_NOTHING; --- 6397,6413 ---- expand_what = EXP_SPELL; else if (STRNICMP(arg, "sync", p - arg) == 0) expand_what = EXP_SYNC; ! else if (STRNICMP(arg, "list", p - arg) == 0) ! { ! p = skipwhite(p); ! if (*p == '@') ! expand_what = EXP_CLUSTER; ! else ! xp->xp_context = EXPAND_HIGHLIGHT; ! } ! else if (STRNICMP(arg, "keyword", p - arg) == 0 || STRNICMP(arg, "region", p - arg) == 0 ! || STRNICMP(arg, "match", p - arg) == 0) xp->xp_context = EXPAND_HIGHLIGHT; else xp->xp_context = EXPAND_NOTHING; *************** *** 6414,6419 **** --- 6422,6430 ---- char_u * get_syntax_name(expand_T *xp UNUSED, int idx) { + #define CBUFFER_LEN 256 + static char_u cbuffer[CBUFFER_LEN]; // TODO: better solution + switch (expand_what) { case EXP_SUBCMD: *************** *** 6437,6442 **** --- 6448,6464 ---- "maxlines=", "minlines=", "region", NULL}; return (char_u *)sync_args[idx]; } + case EXP_CLUSTER: + { + if (idx < curwin->w_s->b_syn_clusters.ga_len) + { + vim_snprintf((char *)cbuffer, CBUFFER_LEN, "@%s", + SYN_CLSTR(curwin->w_s)[idx].scl_name); + return cbuffer; + } + else + return NULL; + } } return NULL; } *** ../vim-9.0.0282/src/testdir/test_syntax.vim 2022-06-23 12:03:23.000000000 +0100 --- src/testdir/test_syntax.vim 2022-08-26 21:51:51.261638493 +0100 *************** *** 201,206 **** --- 201,210 ---- call feedkeys(":syn match \\\"\", 'tx') call assert_match('^"syn match Boolean Character ', @:) + + syn cluster Aax contains=Aap + call feedkeys(":syn list @A\\\"\", 'tx') + call assert_match('^"syn list @Aax', @:) endfunc func Test_echohl_completion() *** ../vim-9.0.0282/src/version.c 2022-08-26 21:33:00.662738976 +0100 --- src/version.c 2022-08-26 21:58:07.457238650 +0100 *************** *** 709,710 **** --- 709,712 ---- { /* Add new patch number below this line */ + /**/ + 283, /**/ -- A special cleaning ordinance bans housewives from hiding dirt and dust under a rug in a dwelling. [real standing law in Pennsylvania, United States of America] /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// \\\ \\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///