Mercurial > vim
comparison src/eval.c @ 538:aa6caa23a4b8 v7.0152
updated for version 7.0152
author | vimboss |
---|---|
date | Fri, 30 Sep 2005 21:23:56 +0000 |
parents | c6296b0ad9ea |
children | f04e890524be |
comparison
equal
deleted
inserted
replaced
537:e321639cfa3e | 538:aa6caa23a4b8 |
---|---|
6885 {"setwinvar", 3, 3, f_setwinvar}, | 6885 {"setwinvar", 3, 3, f_setwinvar}, |
6886 {"simplify", 1, 1, f_simplify}, | 6886 {"simplify", 1, 1, f_simplify}, |
6887 {"sort", 1, 2, f_sort}, | 6887 {"sort", 1, 2, f_sort}, |
6888 {"soundfold", 1, 1, f_soundfold}, | 6888 {"soundfold", 1, 1, f_soundfold}, |
6889 {"spellbadword", 0, 1, f_spellbadword}, | 6889 {"spellbadword", 0, 1, f_spellbadword}, |
6890 {"spellsuggest", 1, 2, f_spellsuggest}, | 6890 {"spellsuggest", 1, 3, f_spellsuggest}, |
6891 {"split", 1, 3, f_split}, | 6891 {"split", 1, 3, f_split}, |
6892 #ifdef HAVE_STRFTIME | 6892 #ifdef HAVE_STRFTIME |
6893 {"strftime", 1, 2, f_strftime}, | 6893 {"strftime", 1, 2, f_strftime}, |
6894 #endif | 6894 #endif |
6895 {"stridx", 2, 3, f_stridx}, | 6895 {"stridx", 2, 3, f_stridx}, |
13959 static void | 13959 static void |
13960 f_spellsuggest(argvars, rettv) | 13960 f_spellsuggest(argvars, rettv) |
13961 typval_T *argvars; | 13961 typval_T *argvars; |
13962 typval_T *rettv; | 13962 typval_T *rettv; |
13963 { | 13963 { |
13964 list_T *l; | |
13965 #ifdef FEAT_SYN_HL | |
13964 char_u *str; | 13966 char_u *str; |
13967 int typeerr = FALSE; | |
13965 int maxcount; | 13968 int maxcount; |
13966 garray_T ga; | 13969 garray_T ga; |
13967 list_T *l; | 13970 int i; |
13968 listitem_T *li; | 13971 listitem_T *li; |
13969 int i; | 13972 int need_capital = FALSE; |
13973 #endif | |
13970 | 13974 |
13971 l = list_alloc(); | 13975 l = list_alloc(); |
13972 if (l == NULL) | 13976 if (l == NULL) |
13973 return; | 13977 return; |
13974 rettv->v_type = VAR_LIST; | 13978 rettv->v_type = VAR_LIST; |
13979 if (curwin->w_p_spell && *curbuf->b_p_spl != NUL) | 13983 if (curwin->w_p_spell && *curbuf->b_p_spl != NUL) |
13980 { | 13984 { |
13981 str = get_tv_string(&argvars[0]); | 13985 str = get_tv_string(&argvars[0]); |
13982 if (argvars[1].v_type != VAR_UNKNOWN) | 13986 if (argvars[1].v_type != VAR_UNKNOWN) |
13983 { | 13987 { |
13984 maxcount = get_tv_number(&argvars[1]); | 13988 maxcount = get_tv_number_chk(&argvars[1], &typeerr); |
13985 if (maxcount <= 0) | 13989 if (maxcount <= 0) |
13986 return; | 13990 return; |
13991 if (argvars[2].v_type != VAR_UNKNOWN) | |
13992 { | |
13993 need_capital = get_tv_number_chk(&argvars[2], &typeerr); | |
13994 if (typeerr) | |
13995 return; | |
13996 } | |
13987 } | 13997 } |
13988 else | 13998 else |
13989 maxcount = 25; | 13999 maxcount = 25; |
13990 | 14000 |
13991 spell_suggest_list(&ga, str, maxcount, FALSE); | 14001 spell_suggest_list(&ga, str, maxcount, need_capital); |
13992 | 14002 |
13993 for (i = 0; i < ga.ga_len; ++i) | 14003 for (i = 0; i < ga.ga_len; ++i) |
13994 { | 14004 { |
13995 str = ((char_u **)ga.ga_data)[i]; | 14005 str = ((char_u **)ga.ga_data)[i]; |
13996 | 14006 |