diff options
author | Bram Moolenaar <Bram@vim.org> | 2005-06-28 23:32:02 +0000 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2005-06-28 23:32:02 +0000 |
commit | 24bbcfe8fe62ea43b1cea86243be4fdc8794140b (patch) | |
tree | f3e45e2890b4a0b79aaf7fa4fababaf2515ce828 | |
parent | d7b31706f766d3167069429c7f2f2f451ac72ecb (diff) | |
download | vim-24bbcfe8fe62ea43b1cea86243be4fdc8794140b.zip |
updated for version 7.0096
-rw-r--r-- | runtime/doc/eval.txt | 20 | ||||
-rw-r--r-- | runtime/doc/options.txt | 58 | ||||
-rw-r--r-- | runtime/doc/spell.txt | 32 | ||||
-rw-r--r-- | runtime/doc/tags | 7 | ||||
-rw-r--r-- | runtime/doc/todo.txt | 20 | ||||
-rw-r--r-- | runtime/indent/ld.vim | 49 | ||||
-rw-r--r-- | runtime/menu.vim | 4 | ||||
-rw-r--r-- | src/eval.c | 91 | ||||
-rw-r--r-- | src/ex_cmds.h | 2 | ||||
-rw-r--r-- | src/memline.c | 2 | ||||
-rw-r--r-- | src/misc1.c | 54 | ||||
-rw-r--r-- | src/option.c | 25 | ||||
-rw-r--r-- | src/option.h | 7 | ||||
-rw-r--r-- | src/proto/eval.pro | 3 | ||||
-rw-r--r-- | src/proto/misc1.pro | 6 | ||||
-rw-r--r-- | src/proto/spell.pro | 3 | ||||
-rw-r--r-- | src/version.h | 4 |
17 files changed, 315 insertions, 72 deletions
diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt index 85916e484..b4f71d2de 100644 --- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -1,4 +1,4 @@ -*eval.txt* For Vim version 7.0aa. Last change: 2005 Jun 27 +*eval.txt* For Vim version 7.0aa. Last change: 2005 Jun 28 VIM REFERENCE MANUAL by Bram Moolenaar @@ -1147,10 +1147,10 @@ v:beval_lnum The number of the line, over which the mouse pointer is. Only valid while evaluating the 'balloonexpr' option. *v:beval_text* *beval_text-variable* -v:beval_text The text under or after the mouse pointer. Usually a word as it is - useful for debugging a C program. 'iskeyword' applies, but a - dot and "->" before the position is included. When on a ']' - the text before it is used, including the matching '[' and +v:beval_text The text under or after the mouse pointer. Usually a word as + it is useful for debugging a C program. 'iskeyword' applies, + but a dot and "->" before the position is included. When on a + ']' the text before it is used, including the matching '[' and word before it. When on a Visual area within one line the highlighted text is used. Only valid while evaluating the 'balloonexpr' option. @@ -1607,6 +1607,7 @@ setreg( {n}, {v}[, {opt}]) Number set register to value and type setwinvar( {nr}, {varname}, {val}) set {varname} in window {nr} to {val} simplify( {filename}) String simplify filename as much as possible sort( {list} [, {func}]) List sort {list}, using {func} to compare +soundfold( {word}) String sound-fold {word} spellbadword() String badly spelled word at cursor spellsuggest({word} [, {max}]) List spelling suggestions split( {expr} [, {pat} [, {keepempty}]]) @@ -3776,6 +3777,15 @@ sort({list} [, {func}]) *sort()* *E702* let sortedlist = sort(mylist, "MyCompare") < + *soundfold()* +soundfold({word}) + Return the sound-folded equivalent of {word}. Uses the first + language in 'spellang' for the current window that supports + soundfolding. When no sound folding is possible the {word} + is returned unmodified. + This can be used for making spelling suggestions. Note that + the method can be quite slow. + *spellbadword()* spellbadword() Return the badly spelled word under or after the cursor. The cursor is advanced to the start of the bad word. diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt index 915f3ebe3..3d47c6b83 100644 --- a/runtime/doc/options.txt +++ b/runtime/doc/options.txt @@ -1,4 +1,4 @@ -*options.txt* For Vim version 7.0aa. Last change: 2005 Jun 24 +*options.txt* For Vim version 7.0aa. Last change: 2005 Jun 28 VIM REFERENCE MANUAL by Bram Moolenaar @@ -5686,17 +5686,55 @@ A jump table for the options with a short description can be found at |Q_op|. {not in Vi} {not available when compiled without the |+syntax| feature} - Method used for spelling suggestions |z?|. Can be one of these - values: + Methods used for spelling suggestions. Both for the |z?| command and + the |spellsuggest()| function. This is a comma-separated list of + items: - best Method that works best for English. Finds small - changes and uses some sound-a-like scoring. - double Uses two methods and mixes the results. The first - method is finding small changes, the other method + best Internal method that works best for English. Finds + changes like "fast" and uses a bit of sound-a-like + scoring to improve the ordering. + + double Internal method that uses two methods and mixes the + results. The first method is "fast", the other method computes how much the suggestion sounds like the bad - word. Can be slow and doesn't always give better - results. - fast Only check for small changes. + word. That only works when the language specifies + sound folding. Can be slow and doesn't always give + better results. + + fast Internal method that only checks for simple changes: + character inserts/deletes/swaps. Works well for + simple typing mistakes. + + file:{filename} Read file {filename}, which must have two columns, + separated by a slash. The first column contains the + bad word, the second column the suggested good word. + Example: + theribal/terrible ~ + Use this for common mistakes that do not appear at the + top of the suggestion list with the internal methods. + Lines without a slash are ignored, use this for + comments. + The file is used for all languages. + + expr:{expr} Evaluate expression {expr}. Use a function to avoid + trouble with spaces. |v:val| holds the badly spelled + word. The expression must evaluate to a List of + Lists, each with a suggestion and a score. + Example: + [['the', 33], ['that', 44]] + Set 'verbose' and use |z?| to see the scores that the + internal methods use. A lower score is better. + This may invoke |spellsuggest()| if you temporarily + set 'spellsuggest' to exclude the "expr:" part. + Errors are silently ignored, unless you set the + 'verbose' option to a non-zero value. + + Only one of "best", "double" or "fast" may be used. The others may + appear several times in any order. Example: > + :set sps=file:~/.vim/sugg,best,expr:MySuggest() +< + This option cannot be set from a |modeline| or in the |sandbox|, for + security reasons. *'splitbelow'* *'sb'* *'nosplitbelow'* *'nosb'* diff --git a/runtime/doc/spell.txt b/runtime/doc/spell.txt index bc0130efa..6accc114d 100644 --- a/runtime/doc/spell.txt +++ b/runtime/doc/spell.txt @@ -1,4 +1,4 @@ -*spell.txt* For Vim version 7.0aa. Last change: 2005 Jun 27 +*spell.txt* For Vim version 7.0aa. Last change: 2005 Jun 28 VIM REFERENCE MANUAL by Bram Moolenaar @@ -87,13 +87,20 @@ Finding suggestions for bad words: *z?* z? For the word under/after the cursor suggest correctly spelled words. This also works to find alternative - for words that are not highlighted as bad words. + for words that are not highlighted as bad words, e.g., + when the word after it is bad. The results are sorted on similarity to the word under/after the cursor. This may take a long time. Hit CTRL-C when you are bored. + This does not work when there is a line break halfway + a bad word (e.g., "the the"). You can enter the number of your choice or press - <Enter> if you don't want to replace. + <Enter> if you don't want to replace. You can also + use the mouse to click on your choice (only works if + the mouse can be used in Normal mode and when there + are no line wraps!). Click on the first (header) line + to cancel. If 'verbose' is non-zero a score will be displayed to indicate the likeliness to the badly spelled word (the higher the score the more different). @@ -101,19 +108,24 @@ z? For the word under/after the cursor suggest correctly repeat the word replacement. This works like "ciw", the good word and <Esc>. + *:spellr* *:spellrepall* *E752* *E753* +:spellr[epall] Repeat the replacement done by |z?| for all matches + with the replaced word in the current window. + The 'spellsuggest' option influences how the list of suggestions is generated and sorted. See |'spellsuggest'|. PERFORMANCE -Note that Vim does on-the-fly spell checking. To make this work fast the -word list is loaded in memory. Thus this uses a lot of memory (1 Mbyte or -more). There might also be a noticeable delay when the word list is loaded, -which happens when 'spell' is set and when 'spelllang' is set while 'spell' -was already set. Each word list is only loaded once, they are not deleted -when 'spelllang' is made empty or 'spell' is reset. When 'encoding' is set -all the word lists are reloaded, thus you may notice a delay then too. +Note that Vim does on-the-fly spell checking. To make this work fast the word +list is loaded in memory. Thus this uses a lot of memory (1 Mbyte or more). +There might also be a noticeable delay when the word list is loaded, which +happens when 'spell' is set and when 'spelllang' is set while 'spell' was +already set. To minimize the delay each word list is only loaded once, it +is not deleted when 'spelllang' is made empty or 'spell' is reset. When +'encoding' is set all the word lists are reloaded, thus you may notice a delay +then too. REGIONS diff --git a/runtime/doc/tags b/runtime/doc/tags index 3f0df20b7..8d9d152fb 100644 --- a/runtime/doc/tags +++ b/runtime/doc/tags @@ -1226,6 +1226,8 @@ $VIMRUNTIME starting.txt /*$VIMRUNTIME* -y starting.txt /*-y* . repeat.txt /*.* .Xdefaults gui_x11.txt /*.Xdefaults* +.aff spell.txt /*.aff* +.dic spell.txt /*.dic* .exrc starting.txt /*.exrc* .gvimrc gui.txt /*.gvimrc* .vimrc starting.txt /*.vimrc* @@ -2230,6 +2232,8 @@ $VIMRUNTIME starting.txt /*$VIMRUNTIME* :print various.txt /*:print* :pro change.txt /*:pro* :prof repeat.txt /*:prof* +:profd repeat.txt /*:profd* +:profdel repeat.txt /*:profdel* :profile repeat.txt /*:profile* :promptfind change.txt /*:promptfind* :promptr change.txt /*:promptr* @@ -3817,6 +3821,7 @@ MiNT os_mint.txt /*MiNT* Moolenaar intro.txt /*Moolenaar* MorphOS os_amiga.txt /*MorphOS* Motif gui_x11.txt /*Motif* +Myspell spell.txt /*Myspell* MzScheme if_mzsch.txt /*MzScheme* N pattern.txt /*N* N% motion.txt /*N%* @@ -4994,6 +4999,7 @@ g_CTRL-] tagsrch.txt /*g_CTRL-]* g` motion.txt /*g`* g`a motion.txt /*g`a* ga various.txt /*ga* +garbagecollect() eval.txt /*garbagecollect()* gd pattern.txt /*gd* ge motion.txt /*ge* get() eval.txt /*get()* @@ -6276,6 +6282,7 @@ spell-affix-vim spell.txt /*spell-affix-vim* spell-dic-format spell.txt /*spell-dic-format* spell-file-format spell.txt /*spell-file-format* spell-load spell.txt /*spell-load* +spell-midword spell.txt /*spell-midword* spell-mkspell spell.txt /*spell-mkspell* spell-quickstart spell.txt /*spell-quickstart* spell-syntax spell.txt /*spell-syntax* diff --git a/runtime/doc/todo.txt b/runtime/doc/todo.txt index 5754b6ee5..597337542 100644 --- a/runtime/doc/todo.txt +++ b/runtime/doc/todo.txt @@ -1,4 +1,4 @@ -*todo.txt* For Vim version 7.0aa. Last change: 2005 Jun 27 +*todo.txt* For Vim version 7.0aa. Last change: 2005 Jun 28 VIM REFERENCE MANUAL by Bram Moolenaar @@ -100,23 +100,13 @@ PLANNED FOR VERSION 7.0: - Add SPELLCHECKER, with support for many languages. - Spell checking code todo's: - - Support user function to make suggestions: - :set spellsuggest=MySuggest,fast - Also support a list with common mistakes? - - For "z?" a "replace all" mechanism would be welcome. - - Add hl groups to 'spelllang'? - :set spelllang=en_us,en-rare/SpellRare,en-math/SpellMath - More complicated: Regions with different languages? E.g. comments - in English, strings in German (po file). - Code for making suggestions: - Hebrew: also use prefixes for suggestions. See message from Kaminsky (June 20) for ideas. - - The sound-folding doesn't work for multi-byte characters. It's - very slow too. - Simple and fast sound-a-like: mapping list for first char and rest vowel as first char: * remove other vowels - - Proofread and cleanup spell help. + - Proofread and cleanup spell help. - Use "engspchk" from Charles Campbell for ideas (commands, rare words). - Make "en-rare" spell file? Ask Charles Campbell. - References: MySpell library (in OpenOffice.org). @@ -142,6 +132,10 @@ PLANNED FOR VERSION 7.0: - The English dictionaries for different regions are not consistent in their use of words with a dash. Later: + - Add hl groups to 'spelllang'? + :set spelllang=en_us,en-rare/SpellRare,en-math/SpellMath + More complicated: Regions with different languages? E.g. comments + in English, strings in German (po file). - Implement compound words when it works for Myspell. Current idea has the problem that "foo/X" always allows "foofoo", there is no way to specify a word can only be at the start or end, or that only certain @@ -2944,6 +2938,8 @@ Options: 8 Make ":mksession" store buffer-specific options for the specific buffer. 8 With ":mksession" always store the 'sessionoptions' option, even when "options" isn't in it. (St-Amant) +7 ":with option=value | command": temporarily set an option value and + restore it after the command has executed. 7 Setting an option always sets "w_set_curswant", while this is only required for a few options. Only do it for those options to avoid the side effect. diff --git a/runtime/indent/ld.vim b/runtime/indent/ld.vim new file mode 100644 index 000000000..8c494ce6a --- /dev/null +++ b/runtime/indent/ld.vim @@ -0,0 +1,49 @@ +" Vim indent file +" Language: ld(1) script +" Maintainer: Nikolai Weibull <nikolai+work.vim@bitwi.se> +" Latest Revision: 2005-06-28 + +if exists("b:did_indent") + finish +endif +let b:did_indent = 1 + +setlocal indentexpr=GetLDIndent() +setlocal indentkeys=0{,0},!^F,o,O + +if exists("*GetLDIndent") + finish +endif + +function s:count_braces(lnum, count_open) + let n_open = 0 + let n_close = 0 + let line = getline(a:lnum) + let pattern = '[{}]' + let i = match(line, pattern) + while i != -1 + if synIDattr(synID(a:lnum, i + 1, 0), 'name') !~ 'ld\%(Comment\|String\)' + if line[i] == '{' + let n_open += 1 + elseif line[i] == '}' + if n_open > 0 + let n_open -= 1 + else + let n_close += 1 + endif + endif + endif + let i = match(line, pattern, i + 1) + endwhile + return a:count_open ? n_open : n_close +endfunction + +function GetLDIndent() + let pnum = prevnonblank(v:lnum - 1) + if pnum == 0 + return 0 + endif + + return indent(pnum) + s:count_braces(pnum, 1) * &sw + \ - s:count_braces(v:lnum, 0) * &sw +endfunction diff --git a/runtime/menu.vim b/runtime/menu.vim index 08a6baa21..a568fa16b 100644 --- a/runtime/menu.vim +++ b/runtime/menu.vim @@ -2,7 +2,7 @@ " You can also use this as a start for your own set of menus. " " Maintainer: Bram Moolenaar <Bram@vim.org> -" Last Change: 2005 Jun 11 +" Last Change: 2005 Jun 28 " Note that ":an" (short for ":anoremenu") is often used to make a menu work " in all modes and avoid side effects from mappings defined by the user. @@ -413,6 +413,8 @@ if has("spell") an 40.335.120 &Tools.&Spelling.Spell\ Check\ &Off :set nospell<CR> an 40.335.130 &Tools.&Spelling.To\ &Next\ error<Tab>]s ]s an 40.335.130 &Tools.&Spelling.To\ &Pevious\ error<Tab>[s [s + an 40.335.140 &Tools.&Spelling.Suggest\ &Corrections<Tab>z? z? + an 40.335.150 &Tools.&Spelling.&Repeat\ correction<Tab>:spellrepall :spellrepall<CR> an 40.335.200 &Tools.&Spelling.-SEP1- <Nop> an 40.335.210 &Tools.&Spelling.Set\ language\ to\ "en" :set spl=en spell<CR> an 40.335.220 &Tools.&Spelling.Set\ language\ to\ "en_au" :set spl=en_au spell<CR> diff --git a/src/eval.c b/src/eval.c index 0e9a2ba17..66aed74e2 100644 --- a/src/eval.c +++ b/src/eval.c @@ -367,7 +367,6 @@ static int get_string_tv __ARGS((char_u **arg, typval_T *rettv, int evaluate)); static int get_lit_string_tv __ARGS((char_u **arg, typval_T *rettv, int evaluate)); static int get_list_tv __ARGS((char_u **arg, typval_T *rettv, int evaluate)); static list_T *list_alloc __ARGS((void)); -static void list_unref __ARGS((list_T *l)); static void list_free __ARGS((list_T *l)); static listitem_T *listitem_alloc __ARGS((void)); static void listitem_free __ARGS((listitem_T *item)); @@ -560,6 +559,7 @@ static void f_setreg __ARGS((typval_T *argvars, typval_T *rettv)); static void f_setwinvar __ARGS((typval_T *argvars, typval_T *rettv)); static void f_simplify __ARGS((typval_T *argvars, typval_T *rettv)); static void f_sort __ARGS((typval_T *argvars, typval_T *rettv)); +static void f_soundfold __ARGS((typval_T *argvars, typval_T *rettv)); static void f_spellbadword __ARGS((typval_T *argvars, typval_T *rettv)); static void f_spellsuggest __ARGS((typval_T *argvars, typval_T *rettv)); static void f_split __ARGS((typval_T *argvars, typval_T *rettv)); @@ -596,6 +596,8 @@ static void f_winrestcmd __ARGS((typval_T *argvars, typval_T *rettv)); static void f_winwidth __ARGS((typval_T *argvars, typval_T *rettv)); static void f_writefile __ARGS((typval_T *argvars, typval_T *rettv)); +static void prepare_vimvar __ARGS((int idx, typval_T *save_tv)); +static void restore_vimvar __ARGS((int idx, typval_T *save_tv)); static win_T *find_win_by_nr __ARGS((typval_T *vp)); static pos_T *var2fpos __ARGS((typval_T *varp, int lnum)); static int get_env_len __ARGS((char_u **arg)); @@ -1206,6 +1208,69 @@ eval_to_number(expr) return retval; } +#if defined(FEAT_SYN_HL) || defined(PROTO) +/* + * Evaluate an expression to a list with suggestions. + * For the "expr:" part of 'spellsuggest'. + */ + list_T * +eval_spell_expr(badword, expr) + char_u *badword; + char_u *expr; +{ + typval_T save_val; + typval_T rettv; + list_T *list = NULL; + char_u *p = skipwhite(expr); + + /* Set "v:val" to the bad word. */ + prepare_vimvar(VV_VAL, &save_val); + vimvars[VV_VAL].vv_type = VAR_STRING; + vimvars[VV_VAL].vv_str = badword; + if (p_verbose == 0) + ++emsg_off; + + if (eval1(&p, &rettv, TRUE) == OK) + { + if (rettv.v_type != VAR_LIST) + clear_tv(&rettv); + else + list = rettv.vval.v_list; + } + + if (p_verbose == 0) + --emsg_off; + vimvars[VV_VAL].vv_str = NULL; + restore_vimvar(VV_VAL, &save_val); + + return list; +} + +/* + * "list" is supposed to contain two items: a word and a number. Return the + * word in "pp" and the number as the return value. + * Return -1 if anything isn't right. + * Used to get the good word and score from the eval_spell_expr() result. + */ + int +get_spellword(list, pp) + list_T *list; + char_u **pp; +{ + listitem_T *li; + + li = list->lv_first; + if (li == NULL) + return -1; + *pp = get_tv_string(&li->li_tv); + + li = li->li_next; + if (li == NULL) + return -1; + return get_tv_number(&li->li_tv); +} +#endif + #if (defined(FEAT_USR_CMDS) && defined(FEAT_CMDL_COMPL)) || defined(PROTO) /* * Call some vimL function and return the result as a string @@ -4976,7 +5041,7 @@ list_alloc() * Unreference a list: decrement the reference count and free it when it * becomes zero. */ - static void + void list_unref(l) list_T *l; { @@ -6627,6 +6692,7 @@ static struct fst {"setwinvar", 3, 3, f_setwinvar}, {"simplify", 1, 1, f_simplify}, {"sort", 1, 2, f_sort}, + {"soundfold", 1, 1, f_soundfold}, {"spellbadword", 0, 0, f_spellbadword}, {"spellsuggest", 1, 2, f_spellsuggest}, {"split", 1, 3, f_split}, @@ -8442,8 +8508,6 @@ findfilendir(argvars, rettv, dir) rettv->v_type = VAR_STRING; } -static void prepare_vimvar __ARGS((int idx, typval_T *save_tv)); -static void restore_vimvar __ARGS((int idx, typval_T *save_tv)); static void filter_map __ARGS((typval_T *argvars, typval_T *rettv, int map)); static int filter_map_one __ARGS((typval_T *tv, char_u *expr, int map, int *remp)); @@ -13358,6 +13422,25 @@ f_sort(argvars, rettv) } /* + * "soundfold({word})" function + */ + static void +f_soundfold(argvars, rettv) + typval_T *argvars; + typval_T *rettv; +{ + char_u *s; + + rettv->v_type = VAR_STRING; + s = get_tv_string(&argvars[0]); +#ifdef FEAT_SYN_HL + rettv->vval.v_string = eval_soundfold(s); +#else + rettv->vval.v_string = vim_strsave(s); +#endif +} + +/* * "spellbadword()" function */ /* ARGSUSED */ diff --git a/src/ex_cmds.h b/src/ex_cmds.h index 6a06be5a4..48ef24b05 100644 --- a/src/ex_cmds.h +++ b/src/ex_cmds.h @@ -765,6 +765,8 @@ EX(CMD_spellwrong, "spellwrong", ex_spell, NEEDARG|EXTRA|TRLBAR), EX(CMD_spelldump, "spelldump", ex_spelldump, TRLBAR), +EX(CMD_spellrepall, "spellrepall", ex_spellrepall, + TRLBAR), EX(CMD_sprevious, "sprevious", ex_previous, EXTRA|RANGE|NOTADR|COUNT|BANG|EDITCMD|ARGOPT|TRLBAR), EX(CMD_srewind, "srewind", ex_rewind, diff --git a/src/memline.c b/src/memline.c index 9f9e3074f..47dc00d84 100644 --- a/src/memline.c +++ b/src/memline.c @@ -880,7 +880,7 @@ ml_recover() (void)recover_names(&fname, TRUE, 0); msg_putchar('\n'); MSG_PUTS(_("Enter number of swap file to use (0 to quit): ")); - i = get_number(FALSE); + i = get_number(FALSE, NULL); if (i < 1 || i > len) goto theend; } diff --git a/src/misc1.c b/src/misc1.c index 87c0f1a0a..73d0ef250 100644 --- a/src/misc1.c +++ b/src/misc1.c @@ -3085,15 +3085,20 @@ get_keystroke() } /* - * get a number from the user + * Get a number from the user. + * When "mouse_used" is not NULL allow using the mouse. */ int -get_number(colon) - int colon; /* allow colon to abort */ +get_number(colon, mouse_used) + int colon; /* allow colon to abort */ + int *mouse_used; { int n = 0; int c; + if (mouse_used != NULL) + *mouse_used = FALSE; + /* When not printing messages, the user won't know what to type, return a * zero (as if CR was hit). */ if (msg_silent != 0) @@ -3118,6 +3123,14 @@ get_number(colon) n /= 10; MSG_PUTS("\b \b"); } +#ifdef FEAT_MOUSE + else if (mouse_used != NULL && c == K_LEFTMOUSE) + { + *mouse_used = TRUE; + n = mouse_row + 1; + break; + } +#endif else if (n == 0 && c == ':' && colon) { stuffcharReadbuff(':'); @@ -3137,9 +3150,12 @@ get_number(colon) /* * Ask the user to enter a number. + * When "mouse_used" is not NULL allow using the mouse and in that case return + * the line number. */ int -prompt_for_number() +prompt_for_number(mouse_used) + int *mouse_used; { int i; int save_cmdline_row; @@ -3152,12 +3168,16 @@ prompt_for_number() save_cmdline_row = cmdline_row; cmdline_row = Rows - 1; save_State = State; - State = CMDLINE; + if (mouse_used == NULL) + State = CMDLINE; + else + State = NORMAL; - i = get_number(TRUE); - if (KeyTyped) /* don't call wait_return() now */ + i = get_number(TRUE, mouse_used); + if (KeyTyped) { - msg_putchar('\n'); + /* don't call wait_return() now */ + /* msg_putchar('\n'); */ cmdline_row = msg_row - 1; need_wait_return = FALSE; msg_didany = FALSE; @@ -3426,24 +3446,30 @@ expand_env(src, dst, dstlen) char_u *dst; /* where to put the result */ int dstlen; /* maximum length of the result */ { - expand_env_esc(src, dst, dstlen, FALSE); + expand_env_esc(src, dst, dstlen, FALSE, NULL); } void -expand_env_esc(src, dst, dstlen, esc) - char_u *src; /* input string e.g. "$HOME/vim.hlp" */ +expand_env_esc(srcp, dst, dstlen, esc, startstr) + char_u *srcp; /* input string e.g. "$HOME/vim.hlp" */ char_u *dst; /* where to put the result */ int dstlen; /* maximum length of the result */ int esc; /* escape spaces in expanded variables */ + char_u *startstr; /* start again after this (can be NULL) */ { + char_u *src; char_u *tail; int c; char_u *var; int copy_char; int mustfree; /* var was allocated, need to free it later */ int at_start = TRUE; /* at start of a name */ + int startstr_len = 0; - src = skipwhite(src); + if (startstr != NULL) + startstr_len = STRLEN(startstr); + + src = skipwhite(srcp); --dstlen; /* leave one char space for "\," */ while (*src && dstlen > 0) { @@ -3679,6 +3705,10 @@ expand_env_esc(src, dst, dstlen, esc) at_start = TRUE; *dst++ = *src++; --dstlen; + + if (startstr != NULL && src - startstr_len >= srcp + && STRNCMP(src - startstr_len, startstr, startstr_len) == 0) + at_start = TRUE; } } *dst = NUL; diff --git a/src/option.c b/src/option.c index 389ab6ea3..8553771ae 100644 --- a/src/option.c +++ b/src/option.c @@ -2040,7 +2040,7 @@ static struct vimoption {(char_u *)0L, (char_u *)0L} #endif }, - {"spelllang", "spl", P_STRING|P_ALLOCED|P_VI_DEF|P_COMMA|P_RBUF, + {"spelllang", "spl", P_STRING|P_ALLOCED|P_VI_DEF|P_COMMA|P_RBUF|P_EXPAND, #ifdef FEAT_SYN_HL (char_u *)&p_spl, PV_SPL, {(char_u *)"en", (char_u *)0L} @@ -2049,7 +2049,7 @@ static struct vimoption {(char_u *)0L, (char_u *)0L} #endif }, - {"spellsuggest", "sps", P_STRING|P_VI_DEF, + {"spellsuggest", "sps", P_STRING|P_VI_DEF|P_EXPAND|P_SECURE, #ifdef FEAT_SYN_HL (char_u *)&p_sps, PV_NONE, {(char_u *)"best", (char_u *)0L} @@ -4554,9 +4554,14 @@ option_expand(opt_idx, val) * Expanding this with NameBuff, expand_env() must not be passed IObuff. * Escape spaces when expanding 'tags', they are used to separate file * names. + * For 'spellsuggest' expand after "file:". */ expand_env_esc(val, NameBuff, MAXPATHL, - (char_u **)options[opt_idx].var == &p_tags); + (char_u **)options[opt_idx].var == &p_tags, +#ifdef FEAT_SYN_HL + (char_u **)options[opt_idx].var == &p_sps ? (char_u *)"file:" : +#endif + NULL); if (STRCMP(NameBuff, val) == 0) /* they are the same */ return NULL; @@ -4590,7 +4595,7 @@ didset_options() (void)opt_strings_flags(p_ttym, p_ttym_values, &ttym_flags, FALSE); #endif #ifdef FEAT_SYN_HL - (void)opt_strings_flags(p_sps, p_sps_values, &sps_flags, FALSE); + (void)spell_check_sps(); #endif #if defined(FEAT_TOOLBAR) && !defined(FEAT_GUI_W32) (void)opt_strings_flags(p_toolbar, p_toolbar_values, &toolbar_flags, TRUE); @@ -5753,7 +5758,7 @@ did_set_string_option(opt_idx, varp, new_value_alloced, oldval, errbuf, /* 'spellsuggest' */ else if (varp == &p_sps) { - if (opt_strings_flags(p_sps, p_sps_values, &sps_flags, FALSE) != OK) + if (spell_check_sps() != OK) errmsg = e_invarg; } #endif @@ -9013,6 +9018,16 @@ set_context_in_set_cmd(xp, arg, opt_flags) break; } } + +#ifdef FEAT_SYN_HL + /* for 'spellsuggest' start at "file:" */ + if (options[opt_idx].var == (char_u *)&p_sps + && STRNCMP(p, "file:", 5) == 0) + { + xp->xp_pattern = p + 5; + break; + } +#endif } return; diff --git a/src/option.h b/src/option.h index 0be4ac308..2b7e80d7e 100644 --- a/src/option.h +++ b/src/option.h @@ -708,13 +708,6 @@ EXTERN int p_sb; /* 'splitbelow' */ #endif #ifdef FEAT_SYN_HL EXTERN char_u *p_sps; /* 'spellsuggest' */ -EXTERN unsigned sps_flags; -# ifdef IN_OPTION_C -static char *(p_sps_values[]) = {"best", "fast", "double", NULL}; -# endif -# define SPS_BEST 0x01 -# define SPS_FAST 0x02 -# define SPS_DOUBLE 0x04 #endif #ifdef FEAT_VERTSPLIT EXTERN int p_spr; /* 'splitright' */ diff --git a/src/proto/eval.pro b/src/proto/eval.pro index f03b28be9..9505ed027 100644 --- a/src/proto/eval.pro +++ b/src/proto/eval.pro @@ -20,6 +20,8 @@ int skip_expr __ARGS((char_u **pp)); char_u *eval_to_string __ARGS((char_u *arg, char_u **nextcmd)); char_u *eval_to_string_safe __ARGS((char_u *arg, char_u **nextcmd)); int eval_to_number __ARGS((char_u *expr)); +list_T *eval_spell_expr __ARGS((char_u *badword, char_u *expr)); +int get_spellword __ARGS((list_T *list, char_u **pp)); char_u *call_vim_function __ARGS((char_u *func, int argc, char_u **argv, int safe)); void *save_funccal __ARGS((void)); void restore_funccal __ARGS((void *vfc)); @@ -37,6 +39,7 @@ void ex_lockvar __ARGS((exarg_T *eap)); int do_unlet __ARGS((char_u *name, int forceit)); void del_menutrans_vars __ARGS((void)); char_u *get_user_var_name __ARGS((expand_T *xp, int idx)); +void list_unref __ARGS((list_T *l)); int list_append_dict __ARGS((list_T *list, dict_T *dict)); int garbage_collect __ARGS((void)); dict_T *dict_alloc __ARGS((void)); diff --git a/src/proto/misc1.pro b/src/proto/misc1.pro index 94d04554c..be4c9df43 100644 --- a/src/proto/misc1.pro +++ b/src/proto/misc1.pro @@ -41,15 +41,15 @@ void check_status __ARGS((buf_T *buf)); void change_warning __ARGS((int col)); int ask_yesno __ARGS((char_u *str, int direct)); int get_keystroke __ARGS((void)); -int get_number __ARGS((int colon)); -int prompt_for_number __ARGS((void)); +int get_number __ARGS((int colon, int *mouse_used)); +int prompt_for_number __ARGS((int *mouse_used)); void msgmore __ARGS((long n)); void beep_flush __ARGS((void)); void vim_beep __ARGS((void)); void init_homedir __ARGS((void)); void free_homedir __ARGS((void)); void expand_env __ARGS((char_u *src, char_u *dst, int dstlen)); -void expand_env_esc __ARGS((char_u *src, char_u *dst, int dstlen, int esc)); +void expand_env_esc __ARGS((char_u *srcp, char_u *dst, int dstlen, int esc, char_u *startstr)); char_u *vim_getenv __ARGS((char_u *name, int *mustfree)); char_u *expand_env_save __ARGS((char_u *src)); void vim_setenv __ARGS((char_u *name, char_u *val)); diff --git a/src/proto/spell.pro b/src/proto/spell.pro index 37830ca6e..91483b022 100644 --- a/src/proto/spell.pro +++ b/src/proto/spell.pro @@ -10,7 +10,10 @@ void ex_mkspell __ARGS((exarg_T *eap)); void ex_spell __ARGS((exarg_T *eap)); void spell_add_word __ARGS((char_u *word, int len, int bad)); void init_spell_chartab __ARGS((void)); +int spell_check_sps __ARGS((void)); void spell_suggest __ARGS((void)); +void ex_spellrepall __ARGS((exarg_T *eap)); void spell_suggest_list __ARGS((garray_T *gap, char_u *word, int maxcount)); +char_u *eval_soundfold __ARGS((char_u *word)); void ex_spelldump __ARGS((exarg_T *eap)); /* vim: set ft=c : */ diff --git a/src/version.h b/src/version.h index 4dbd342ed..1b12b0ca2 100644 --- a/src/version.h +++ b/src/version.h @@ -36,5 +36,5 @@ #define VIM_VERSION_NODOT "vim70aa" #define VIM_VERSION_SHORT "7.0aa" #define VIM_VERSION_MEDIUM "7.0aa ALPHA" -#define VIM_VERSION_LONG "VIM - Vi IMproved 7.0aa ALPHA (2005 Jun 27)" -#define VIM_VERSION_LONG_DATE "VIM - Vi IMproved 7.0aa ALPHA (2005 Jun 27, compiled " +#define VIM_VERSION_LONG "VIM - Vi IMproved 7.0aa ALPHA (2005 Jun 28)" +#define VIM_VERSION_LONG_DATE "VIM - Vi IMproved 7.0aa ALPHA (2005 Jun 28, compiled " |