@@ -6383,7 +6383,9 @@ syntax_present(win_T *win)
63836383static enum
63846384{
63856385 EXP_SUBCMD , /* expand ":syn" sub-commands */
6386- EXP_CASE /* expand ":syn case" arguments */
6386+ EXP_CASE , /* expand ":syn case" arguments */
6387+ EXP_SPELL , /* expand ":syn spell" arguments */
6388+ EXP_SYNC /* expand ":syn sync" arguments */
63876389} expand_what ;
63886390
63896391/*
@@ -6434,6 +6436,10 @@ set_context_in_syntax_cmd(expand_T *xp, char_u *arg)
64346436 xp -> xp_context = EXPAND_NOTHING ;
64356437 else if (STRNICMP (arg , "case" , p - arg ) == 0 )
64366438 expand_what = EXP_CASE ;
6439+ else if (STRNICMP (arg , "spell" , p - arg ) == 0 )
6440+ expand_what = EXP_SPELL ;
6441+ else if (STRNICMP (arg , "sync" , p - arg ) == 0 )
6442+ expand_what = EXP_SYNC ;
64376443 else if ( STRNICMP (arg , "keyword" , p - arg ) == 0
64386444 || STRNICMP (arg , "region" , p - arg ) == 0
64396445 || STRNICMP (arg , "match" , p - arg ) == 0
@@ -6445,18 +6451,38 @@ set_context_in_syntax_cmd(expand_T *xp, char_u *arg)
64456451 }
64466452}
64476453
6448- static char * (case_args []) = {"match" , "ignore" , NULL };
6449-
64506454/*
64516455 * Function given to ExpandGeneric() to obtain the list syntax names for
64526456 * expansion.
64536457 */
64546458 char_u *
64556459get_syntax_name (expand_T * xp UNUSED , int idx )
64566460{
6457- if (expand_what == EXP_SUBCMD )
6458- return (char_u * )subcommands [idx ].name ;
6459- return (char_u * )case_args [idx ];
6461+ switch (expand_what )
6462+ {
6463+ case EXP_SUBCMD :
6464+ return (char_u * )subcommands [idx ].name ;
6465+ case EXP_CASE :
6466+ {
6467+ static char * case_args [] = {"match" , "ignore" , NULL };
6468+ return (char_u * )case_args [idx ];
6469+ }
6470+ case EXP_SPELL :
6471+ {
6472+ static char * spell_args [] =
6473+ {"toplevel" , "notoplevel" , "default" , NULL };
6474+ return (char_u * )spell_args [idx ];
6475+ }
6476+ case EXP_SYNC :
6477+ {
6478+ static char * sync_args [] =
6479+ {"ccomment" , "clear" , "fromstart" ,
6480+ "linebreaks=" , "linecont" , "lines=" , "match" ,
6481+ "maxlines=" , "minlines=" , "region" , NULL };
6482+ return (char_u * )sync_args [idx ];
6483+ }
6484+ }
6485+ return NULL ;
64606486}
64616487
64626488#endif /* FEAT_CMDL_COMPL */
@@ -6704,8 +6730,10 @@ syntime_report(void)
67046730 }
67056731 }
67066732
6707- /* sort on total time */
6708- qsort (ga .ga_data , (size_t )ga .ga_len , sizeof (time_entry_T ),
6733+ /* Sort on total time. Skip if there are no items to avoid passing NULL
6734+ * pointer to qsort(). */
6735+ if (ga .ga_len > 1 )
6736+ qsort (ga .ga_data , (size_t )ga .ga_len , sizeof (time_entry_T ),
67096737 syn_compare_syntime );
67106738
67116739 MSG_PUTS_TITLE (_ (" TOTAL COUNT MATCH SLOWEST AVERAGE NAME PATTERN" ));
0 commit comments