To: vim_dev@googlegroups.com Subject: Patch 8.0.0157 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.0.0157 Problem: No command line completion for ":syntax spell" and ":syntax sync". Solution: Implement the completion. (Dominique Pelle) Files: src/syntax.c, src/testdir/test_syntax.vim *** ../vim-8.0.0156/src/syntax.c 2017-01-08 17:46:16.016900321 +0100 --- src/syntax.c 2017-01-08 18:27:27.062154264 +0100 *************** *** 6383,6389 **** static enum { EXP_SUBCMD, /* expand ":syn" sub-commands */ ! EXP_CASE /* expand ":syn case" arguments */ } expand_what; /* --- 6383,6391 ---- static enum { 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; /* *************** *** 6434,6439 **** --- 6436,6445 ---- xp->xp_context = EXPAND_NOTHING; else if (STRNICMP(arg, "case", p - arg) == 0) expand_what = EXP_CASE; + else if (STRNICMP(arg, "spell", p - arg) == 0) + 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 *************** *** 6445,6452 **** } } - static char *(case_args[]) = {"match", "ignore", NULL}; - /* * Function given to ExpandGeneric() to obtain the list syntax names for * expansion. --- 6451,6456 ---- *************** *** 6454,6462 **** char_u * get_syntax_name(expand_T *xp UNUSED, int idx) { ! if (expand_what == EXP_SUBCMD) ! return (char_u *)subcommands[idx].name; ! return (char_u *)case_args[idx]; } #endif /* FEAT_CMDL_COMPL */ --- 6458,6488 ---- char_u * get_syntax_name(expand_T *xp UNUSED, int idx) { ! switch (expand_what) ! { ! case EXP_SUBCMD: ! return (char_u *)subcommands[idx].name; ! case EXP_CASE: ! { ! static char *case_args[] = {"match", "ignore", NULL}; ! return (char_u *)case_args[idx]; ! } ! case EXP_SPELL: ! { ! static char *spell_args[] = ! {"toplevel", "notoplevel", "default", NULL}; ! return (char_u *)spell_args[idx]; ! } ! case EXP_SYNC: ! { ! static char *sync_args[] = ! {"ccomment", "clear", "fromstart", ! "linebreaks=", "linecont", "lines=", "match", ! "maxlines=", "minlines=", "region", NULL}; ! return (char_u *)sync_args[idx]; ! } ! } ! return NULL; } #endif /* FEAT_CMDL_COMPL */ *** ../vim-8.0.0156/src/testdir/test_syntax.vim 2016-12-11 15:24:45.015136329 +0100 --- src/testdir/test_syntax.vim 2017-01-08 18:25:38.922970741 +0100 *************** *** 150,155 **** --- 150,161 ---- call feedkeys(":syn case \\\"\", 'tx') call assert_equal('"syn case ignore match', @:) + call feedkeys(":syn spell \\\"\", 'tx') + call assert_equal('"syn spell default notoplevel toplevel', @:) + + call feedkeys(":syn sync \\\"\", 'tx') + call assert_equal('"syn sync ccomment clear fromstart linebreaks= linecont lines= match maxlines= minlines= region', @:) + call feedkeys(":syn list \\\"\", 'tx') call assert_match('^"syn list Boolean Character ', @:) *** ../vim-8.0.0156/src/version.c 2017-01-08 17:58:58.767107006 +0100 --- src/version.c 2017-01-08 18:26:14.842699536 +0100 *************** *** 766,767 **** --- 766,769 ---- { /* Add new patch number below this line */ + /**/ + 157, /**/ -- hundred-and-one symptoms of being an internet addict: 228. You spend Saturday night making the counter on your home page pass that 2000 mark. /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///