Mirror of the Vim source from https://github.com/vim/vim
修訂 | 4772a5e3f9fa652baa1cb6d5295d60daeef6ef0b (tree) |
---|---|
時間 | 2005-08-30 07:25:38 |
作者 | vimboss |
Commiter | vimboss |
updated for version 7.0138
@@ -155,6 +155,17 @@ | ||
155 | 155 | In order to list buffer-local autocommands, use a pattern in the form <buffer> |
156 | 156 | or <buffer=N>. See |autocmd-buflocal|. |
157 | 157 | |
158 | + *:autocmd-verbose* | |
159 | +When 'verbose' is non-zero, listing an autocommand will also display where it | |
160 | +was last defined. Example: > | |
161 | + | |
162 | + :verbose autocmd BufEnter | |
163 | + FileExplorer BufEnter | |
164 | + * call s:LocalBrowse(expand("<amatch>")) | |
165 | + Last set from /usr/share/vim/vim-7.0/plugin/NetrwPlugin.vim | |
166 | +< | |
167 | +See |:verbose-cmd| for more information. | |
168 | + | |
158 | 169 | ============================================================================== |
159 | 170 | 5. Events *autocmd-events* *E215* *E216* |
160 | 171 |
@@ -1,4 +1,4 @@ | ||
1 | -*options.txt* For Vim version 7.0aa. Last change: 2005 Aug 23 | |
1 | +*options.txt* For Vim version 7.0aa. Last change: 2005 Aug 27 | |
2 | 2 | |
3 | 3 | |
4 | 4 | VIM REFERENCE MANUAL by Bram Moolenaar |
@@ -1100,7 +1100,8 @@ | ||
1100 | 1100 | {not available when compiled without the |+linebreak| |
1101 | 1101 | feature} |
1102 | 1102 | This option lets you choose which characters might cause a line |
1103 | - break if 'linebreak' is on. | |
1103 | + break if 'linebreak' is on. Only works for ASCII and also for 8-bit | |
1104 | + characters when 'encoding' is an 8-bit encoding. | |
1104 | 1105 | |
1105 | 1106 | *'browsedir'* *'bsdir'* |
1106 | 1107 | 'browsedir' 'bsdir' string (default: "last") |
@@ -7282,7 +7283,8 @@ | ||
7282 | 7283 | *'wrapscan'* *'ws'* *'nowrapscan'* *'nows'* |
7283 | 7284 | 'wrapscan' 'ws' boolean (default on) *E384* *E385* |
7284 | 7285 | global |
7285 | - Searches wrap around the end of the file. | |
7286 | + Searches wrap around the end of the file. Also applies to |]s| and | |
7287 | + |[s|, searching for spelling mistakes. | |
7286 | 7288 | |
7287 | 7289 | *'write'* *'nowrite'* |
7288 | 7290 | 'write' boolean (default on) |
@@ -1,4 +1,4 @@ | ||
1 | -*quickref.txt* For Vim version 7.0aa. Last change: 2005 Jul 27 | |
1 | +*quickref.txt* For Vim version 7.0aa. Last change: 2005 Aug 29 | |
2 | 2 | |
3 | 3 | |
4 | 4 | VIM REFERENCE MANUAL by Bram Moolenaar |
@@ -756,6 +756,7 @@ | ||
756 | 756 | |'maxmempattern'| |'mmp'| maximum memory (in Kbyte) used for pattern search |
757 | 757 | |'maxmemtot'| |'mmt'| maximum memory (in Kbyte) used for all buffers |
758 | 758 | |'menuitems'| |'mis'| maximum number of items in a menu |
759 | +|'mkspellmem'| |'msm'| memory used before |:mkspell| compresses the tree | |
759 | 760 | |'modeline'| |'ml'| recognize modelines at start or end of file |
760 | 761 | |'modelines'| |'mls'| number of lines checked for modelines |
761 | 762 | |'modifiable'| |'ma'| changes to the text are not possible |
@@ -1,4 +1,4 @@ | ||
1 | -*spell.txt* For Vim version 7.0aa. Last change: 2005 Aug 25 | |
1 | +*spell.txt* For Vim version 7.0aa. Last change: 2005 Aug 29 | |
2 | 2 | |
3 | 3 | |
4 | 4 | VIM REFERENCE MANUAL by Bram Moolenaar |
@@ -43,6 +43,7 @@ | ||
43 | 43 | *]s* *E756* |
44 | 44 | ]s Move to next misspelled word after the cursor. |
45 | 45 | A count before the command can be used to repeat. |
46 | + 'wrapscan' applies. | |
46 | 47 | |
47 | 48 | *[s* |
48 | 49 | [s Like "]s" but search backwards, find the misspelled |
@@ -514,7 +515,7 @@ | ||
514 | 515 | |
515 | 516 | *:spelldump* *:spelld* |
516 | 517 | :spelld[ump] Open a new window and fill it with all currently valid |
517 | - words. | |
518 | + words. Compound words are not included. | |
518 | 519 | Note: For some languages the result may be enormous, |
519 | 520 | causing Vim to run out of memory. |
520 | 521 |
@@ -915,6 +916,12 @@ | ||
915 | 916 | |
916 | 917 | NEEDAFFIX + ~ |
917 | 918 | |
919 | + *spell-NEEDCOMPOUND* | |
920 | +The NEEDCOMPOUND flag is used to require that a word is used as part of a | |
921 | +compound word The word itself is not a good word. Example: | |
922 | + | |
923 | + NEEDCOMPOUND & ~ | |
924 | + | |
918 | 925 | |
919 | 926 | COMPOUND WORDS *spell-compound* |
920 | 927 |
@@ -988,13 +995,13 @@ | ||
988 | 995 | This allows for the word "start-end", but not "startend". |
989 | 996 | |
990 | 997 | *spell-COMPOUNDMIN* |
991 | -The minimal byte length of a word used for concatenation is specified with | |
998 | +The minimal character length of a word used for compounding is specified with | |
992 | 999 | COMPOUNDMIN. Example: |
993 | 1000 | COMPOUNDMIN 5 ~ |
994 | 1001 | |
995 | -When omitted a minimal length of 3 bytes is used. Obviously you could just | |
996 | -leave out the compound flag from short words instead, this feature is present | |
997 | -for compatibility with Myspell. | |
1002 | +When omitted there is no minimal length. Obviously you could just leave out | |
1003 | +the compound flag from short words instead, this feature is present for | |
1004 | +compatibility with Myspell. | |
998 | 1005 | |
999 | 1006 | *spell-COMPOUNDMAX* |
1000 | 1007 | The maximum number of words that can be concatenated into a compound word is |
@@ -4226,6 +4226,7 @@ | ||
4226 | 4226 | autocmd-remove autocmd.txt /*autocmd-remove* |
4227 | 4227 | autocmd-searchpat autocmd.txt /*autocmd-searchpat* |
4228 | 4228 | autocmd-use autocmd.txt /*autocmd-use* |
4229 | +autocmd-verbose autocmd.txt /*autocmd-verbose* | |
4229 | 4230 | autocmd.txt autocmd.txt /*autocmd.txt* |
4230 | 4231 | autocmds-kept version5.txt /*autocmds-kept* |
4231 | 4232 | autocommand autocmd.txt /*autocommand* |
@@ -1,4 +1,4 @@ | ||
1 | -*term.txt* For Vim version 7.0aa. Last change: 2005 Jun 06 | |
1 | +*term.txt* For Vim version 7.0aa. Last change: 2005 Aug 27 | |
2 | 2 | |
3 | 3 | |
4 | 4 | VIM REFERENCE MANUAL by Bram Moolenaar |
@@ -291,6 +291,7 @@ | ||
291 | 291 | t_WS set window size (height, width) in characters *t_WS* *'t_WS'* |
292 | 292 | t_SI start insert mode (bar cursor shape) *t_SI* *'t_SI'* |
293 | 293 | t_EI end insert mode (block cursor shape) *t_EI* *'t_EI'* |
294 | + |termcap-cursor-shape| | |
294 | 295 | t_RV request terminal version string (for xterm) *t_RV* *'t_RV'* |
295 | 296 | |xterm-8bit| |v:termresponse| |'ttymouse'| |xterm-codes| |
296 | 297 |
@@ -427,6 +428,7 @@ | ||
427 | 428 | endif |
428 | 429 | NOTE: When Vim exits the shape for Normal mode will remain. The shape from |
429 | 430 | before Vim started will not be restored. |
431 | +{not available when compiled without the +cursorshape feature} | |
430 | 432 | |
431 | 433 | *termcap-title* |
432 | 434 | The 't_ts' and 't_fs' options are used to set the window title if the terminal |
@@ -1,4 +1,4 @@ | ||
1 | -*todo.txt* For Vim version 7.0aa. Last change: 2005 Aug 25 | |
1 | +*todo.txt* For Vim version 7.0aa. Last change: 2005 Aug 29 | |
2 | 2 | |
3 | 3 | |
4 | 4 | VIM REFERENCE MANUAL by Bram Moolenaar |
@@ -31,21 +31,14 @@ | ||
31 | 31 | -------------------- Known bugs and current work ----------------------- |
32 | 32 | |
33 | 33 | Spelling: |
34 | -- Use 'wrapscan' for "[s" and "]s"? | |
35 | - | |
36 | -- Is there a way to avoid compound IDs taking two utf-8 bytes? | |
37 | - | |
38 | -- Make COMPOUNDMIN 3 characters instead of 3 bytes. | |
39 | - | |
40 | 34 | - Check support of flags of two characters, numbers (comma separated) and HUH. |
41 | 35 | When using many compound flags, does regexp still work? |
42 | 36 | |
37 | +- "zg" doesn't work for Thai? | |
38 | + | |
43 | 39 | - Compound word is accepted if nr of words is <= COMPOUNDMAX OR nr of |
44 | 40 | syllables <= COMPOUNDSYLMAX. Specify AND in the affix file? |
45 | 41 | |
46 | -- ONLYINCOMPOUND -> NEEDCOMPOUND (also used for affix? or use "needcomp" | |
47 | - after affix) | |
48 | - | |
49 | 42 | - COMPOUNDMAX -> COMPOUNDWORDMAX? |
50 | 43 | |
51 | 44 | - Support flags on a suffix. Used for second level affixes. |
@@ -54,6 +47,8 @@ | ||
54 | 47 | flags of the word are not used. |
55 | 48 | Instead of "SFX a 0 add/FLAGS ." we could use "SFX a 0 add . /FLAGS". |
56 | 49 | |
50 | +- NEEDCOMPOUND also used for affix? Or use "needcomp" after affix? | |
51 | + | |
57 | 52 | - Do we need a flag for the rule that when compounding is done the following |
58 | 53 | word doesn't have a capital after a word character, even for Onecap words? |
59 | 54 |
@@ -1482,6 +1477,10 @@ | ||
1482 | 1477 | 7 In "-- INSERT (lang) --" show the name of the keymap used instead of |
1483 | 1478 | "lang". (Ilya Dogolazky) |
1484 | 1479 | - Make 'langmap' accept multi-byte characters. |
1480 | +- Make 'breakat' accept multi-byte characters. Problem: can't use a lookup | |
1481 | + table anymore (breakat_flags[]). | |
1482 | + Simplistic solution: when 'formatoptions' contains "m" also break a line | |
1483 | + at a multi-byte character >= 0x100. | |
1485 | 1484 | - Do we need the reverse of 'keymap', like 'langmap' but with files and |
1486 | 1485 | multi-byte characters? E.g., when using a Russian keyboard. |
1487 | 1486 | - Add the possibility to enter mappings which are used whenever normal text |
@@ -1,4 +1,4 @@ | ||
1 | -*various.txt* For Vim version 7.0aa. Last change: 2005 Jun 22 | |
1 | +*various.txt* For Vim version 7.0aa. Last change: 2005 Aug 27 | |
2 | 2 | |
3 | 3 | |
4 | 4 | VIM REFERENCE MANUAL by Bram Moolenaar |
@@ -268,6 +268,8 @@ | ||
268 | 268 | N *+comments* |'comments'| support |
269 | 269 | N *+cryptv* encryption support |encryption| |
270 | 270 | B *+cscope* |cscope| support |
271 | +m *+cursorshape* |termcap-cursor-shape| support | |
272 | +m *+debug* Compiled for debugging. | |
271 | 273 | N *+dialog_gui* Support for |:confirm| with GUI dialog. |
272 | 274 | N *+dialog_con* Support for |:confirm| with console dialog. |
273 | 275 | N *+dialog_con_gui* Support for |:confirm| with GUI and console dialog. |
@@ -487,10 +489,11 @@ | ||
487 | 489 | |
488 | 490 | *:verbose-cmd* |
489 | 491 | When 'verbose' is non-zero, listing the value of a Vim option or a key map or |
490 | -a user-defined function or a command or a highlight group will also display | |
491 | -where it was last defined. If it was defined manually then there will be no | |
492 | -"Last set" message. When it was defined while executing a function, user | |
493 | -command or autocommand, the script in which it was defined is reported. | |
492 | +a user-defined function or a command or a highlight group or an autocommand | |
493 | +will also display where it was last defined. If it was defined manually then | |
494 | +there will be no "Last set" message. When it was defined while executing a | |
495 | +function, user command or autocommand, the script in which it was defined is | |
496 | +reported. | |
494 | 497 | {not available when compiled without the +eval feature} |
495 | 498 | |
496 | 499 | *K* |
@@ -1,4 +1,4 @@ | ||
1 | -*version7.txt* For Vim version 7.0aa. Last change: 2005 Aug 24 | |
1 | +*version7.txt* For Vim version 7.0aa. Last change: 2005 Aug 28 | |
2 | 2 | |
3 | 3 | |
4 | 4 | VIM REFERENCE MANUAL by Bram Moolenaar |
@@ -327,7 +327,7 @@ | ||
327 | 327 | Normal mode commands: ~ |
328 | 328 | |
329 | 329 | a", a' and a` New text objects to select quoted strings. |a'| |
330 | -i", i' and i' (Taro Muraoka) | |
330 | +i", i' and i` (Taro Muraoka) | |
331 | 331 | |
332 | 332 | CTRL-W <Enter> In the quickfix window: opens a new window to show the |
333 | 333 | location of the error under the cursor. |
@@ -565,8 +565,8 @@ | ||
565 | 565 | |
566 | 566 | When 'verbose' is set the output of ":highlight" will show where a highlight |
567 | 567 | item was last set. |
568 | -When 'verbose' is set the output of ":map", ":command" and ":function" | |
569 | -commands will show where it was last defined. (Yegappan Lakshmanan) | |
568 | +When 'verbose' is set the output of the ":map", ":command", ":function" and | |
569 | +":autocmd" commands will show where it was last defined. (Yegappan Lakshmanan) | |
570 | 570 | |
571 | 571 | ============================================================================== |
572 | 572 | IMPROVEMENTS *improvements-7* |
@@ -774,6 +774,11 @@ | ||
774 | 774 | When no locale is set, thus using the "C" locale, Vim will work with latin1 |
775 | 775 | characters, using it's own isupper()/toupper()/etc. functions. |
776 | 776 | |
777 | +When using an rxvt terminal emulator guess the value of 'background' using the | |
778 | +COLORFGBG environment variable. (Ciaran McCreesh) | |
779 | + | |
780 | +Also support t_SI and t_EI on Unix with normal features. (Ciaran McCreesh) | |
781 | + | |
777 | 782 | ============================================================================== |
778 | 783 | COMPILE TIME CHANGES *compile-changes-7* |
779 | 784 |
@@ -1,7 +1,7 @@ | ||
1 | 1 | " Vim support file to detect file types |
2 | 2 | " |
3 | 3 | " Maintainer: Bram Moolenaar <Bram@vim.org> |
4 | -" Last Change: 2005 Aug 24 | |
4 | +" Last Change: 2005 Aug 29 | |
5 | 5 | |
6 | 6 | " Listen very carefully, I will say this only once |
7 | 7 | if exists("did_load_filetypes") |
@@ -1200,7 +1200,7 @@ | ||
1200 | 1200 | " This function checks for an assembly comment the first ten lines. |
1201 | 1201 | " If not found, assume Progress. |
1202 | 1202 | let lnum = 1 |
1203 | - while lnum <= 10 | |
1203 | + while lnum <= 10 && lnum < line('$') | |
1204 | 1204 | let line = getline(lnum) |
1205 | 1205 | if line =~ '^\s*;' || line =~ '^\*' |
1206 | 1206 | call s:FTasm() |
@@ -1227,9 +1227,9 @@ | ||
1227 | 1227 | " Look for either an opening comment or a program start. |
1228 | 1228 | " If not found, assume Progress. |
1229 | 1229 | let lnum = 1 |
1230 | - while lnum <= 10 | |
1230 | + while lnum <= 10 && lnum < line('$') | |
1231 | 1231 | let line = getline(lnum) |
1232 | - if line =~ '^\s*\(program\|procedure\|function\|const\|type\|var\)\>' | |
1232 | + if line =~ '^\s*\(program\|unit\|procedure\|function\|const\|type\|var\)\>' | |
1233 | 1233 | \ || line =~ '^\s*{' || line =~ '^\s*(\*' |
1234 | 1234 | setf pascal |
1235 | 1235 | return |
@@ -1,7 +1,7 @@ | ||
1 | 1 | " These commands create the option window. |
2 | 2 | " |
3 | 3 | " Maintainer: Bram Moolenaar <Bram@vim.org> |
4 | -" Last Change: 2005 Jul 11 | |
4 | +" Last Change: 2005 Aug 29 | |
5 | 5 | |
6 | 6 | " If there already is an option window, jump to that one. |
7 | 7 | if bufwinnr("option-window") > 0 |
@@ -403,6 +403,8 @@ | ||
403 | 403 | call <SID>OptionL("spc") |
404 | 404 | call append("$", "spellsuggest\tmethods used to suggest corrections") |
405 | 405 | call <SID>OptionG("sps", &sps) |
406 | + call append("$", "mkspellmem\tamount of memory used by :mkspell before compressing") | |
407 | + call <SID>OptionG("msm", &msm) | |
406 | 408 | endif |
407 | 409 | |
408 | 410 |
@@ -19,7 +19,6 @@ | ||
19 | 19 | |
20 | 20 | ../README_bg.txt: README_bg_BG.txt |
21 | 21 | :copy $source $target |
22 | - :sys $VIM $target -e -c "set ff=unix" -c wq | |
23 | 22 | |
24 | 23 | # |
25 | 24 | # Fetching the files from OpenOffice.org. |
@@ -35,8 +34,9 @@ | ||
35 | 34 | :fetch bg_BG.zip |
36 | 35 | :sys $UNZIP bg_BG.zip |
37 | 36 | :delete bg_BG.zip |
38 | - :sys $VIM bg_BG.aff -c "set ff=unix" -c "update" -c q | |
39 | - :sys $VIM bg_BG.dic -c "set ff=unix" -c "update" -c q | |
37 | + :sys $VIM bg_BG.aff -e -c "set ff=unix" -c update -c q | |
38 | + :sys $VIM bg_BG.dic -e -c "set ff=unix" -c update -c q | |
39 | + :sys $VIM README_bg_BG.txt -e -c "set ff=unix" -c update -c q | |
40 | 40 | @if not os.path.exists('bg_BG.orig.aff'): |
41 | 41 | :copy bg_BG.aff bg_BG.orig.aff |
42 | 42 | @if not os.path.exists('bg_BG.orig.dic'): |
@@ -4,7 +4,8 @@ | ||
4 | 4 | # aap generate all the .spl files |
5 | 5 | # aap diff create all the diff files |
6 | 6 | |
7 | -LANG = af am bg ca cs da de el en eo es fr fo gl he hr it nl ny pl sk th yi hu | |
7 | +LANG = af am bg ca cs da de el en eo es fr fo gl he hr it nl ny pl ru sk | |
8 | + th yi hu | |
8 | 9 | |
9 | 10 | # "hu" is at the end, because it takes very long. |
10 | 11 | # |
@@ -0,0 +1,104 @@ | ||
1 | +# Aap recipe for Russian Vim spell files. | |
2 | + | |
3 | +# Use a freshly compiled Vim if it exists. | |
4 | +@if os.path.exists('../../../src/vim'): | |
5 | + VIM = ../../../src/vim | |
6 | +@else: | |
7 | + :progsearch VIM vim | |
8 | + | |
9 | +REGIONS = RU IE YO | |
10 | +SPELLDIR = .. | |
11 | +FILES = ru_$*(REGIONS).aff ru_$*(REGIONS).dic | |
12 | + | |
13 | +all: $SPELLDIR/ru.koi8-r.spl $SPELLDIR/ru.utf-8.spl \ | |
14 | + $SPELLDIR/ru.cp1251.spl ../README_ru.txt | |
15 | + | |
16 | +$SPELLDIR/ru.koi8-r.spl : $FILES | |
17 | + :sys env LANG=ru_RU.KOI8-R $VIM -u NONE -e -c "mkspell! $SPELLDIR/ru ru_RU ru_IE ru_YO" -c q | |
18 | + | |
19 | +$SPELLDIR/ru.utf-8.spl : $FILES | |
20 | + :sys env LANG=ru_RU.UTF-8 $VIM -u NONE -e -c "mkspell! $SPELLDIR/ru ru_RU ru_IE ru_YO" -c q | |
21 | + | |
22 | +$SPELLDIR/ru.cp1251.spl : $FILES | |
23 | + :sys env LANG=ru_RU.CP1251 $VIM -u NONE -e -c "mkspell! $SPELLDIR/ru ru_RU ru_IE ru_YO" -c q | |
24 | + | |
25 | +../README_ru.txt: README_ru_$*(REGIONS).txt | |
26 | + :print ru_RU >! $target | |
27 | + :cat README_ru_RU.txt >> $target | |
28 | + :print =================================================== >>$target | |
29 | + :print ru_IE >> $target | |
30 | + :cat README_ru_IE.txt >> $target | |
31 | + :print =================================================== >>$target | |
32 | + :print ru_YO >> $target | |
33 | + :cat README_ru_YO.txt >> $target | |
34 | + | |
35 | +# | |
36 | +# Fetching the files from OpenOffice.org. | |
37 | +# | |
38 | +OODIR = http://ftp.services.openoffice.org/pub/OpenOffice.org/contrib/dictionaries | |
39 | +:attr {fetch = $OODIR/%file%} ru_RU.zip ru_RU_ye.zip ru_RU_yo.zip | |
40 | + | |
41 | +# The files don't depend on the .zip file so that we can delete it. | |
42 | +# Only download the zip file if the targets don't exist. | |
43 | +# This is a bit tricky, since the file name includes the date. | |
44 | +ru_RU.aff ru_RU.dic: {buildcheck=} | |
45 | + :assertpkg unzip | |
46 | + :fetch ru_RU.zip | |
47 | + :sys unzip ru_RU.zip | |
48 | + :delete ru_RU.zip | |
49 | + @if not os.path.exists('ru_RU.orig.aff'): | |
50 | + :copy ru_RU.aff ru_RU.orig.aff | |
51 | + @if not os.path.exists('ru_RU.orig.dic'): | |
52 | + :copy ru_RU.dic ru_RU.orig.dic | |
53 | + @if os.path.exists('ru_RU.diff'): | |
54 | + :sys patch <ru_RU.diff | |
55 | + | |
56 | +ru_IE.aff ru_IE.dic: {buildcheck=} | |
57 | + :assertpkg unzip | |
58 | + :fetch ru_RU_ye.zip | |
59 | + :sys unzip ru_RU_ye.zip | |
60 | + :delete ru_RU_ye.zip | |
61 | + :move ru_RU_ie.aff ru_IE.aff | |
62 | + :move ru_RU_ie.dic ru_IE.dic | |
63 | + :move README_ru_RU_ie.txt README_ru_IE.txt | |
64 | + @if not os.path.exists('ru_IE.orig.aff'): | |
65 | + :copy ru_IE.aff ru_IE.orig.aff | |
66 | + @if not os.path.exists('ru_IE.orig.dic'): | |
67 | + :copy ru_IE.dic ru_IE.orig.dic | |
68 | + @if os.path.exists('ru_IE.diff'): | |
69 | + :sys patch <ru_IE.diff | |
70 | + | |
71 | +ru_YO.aff ru_YO.dic: {buildcheck=} | |
72 | + :assertpkg unzip | |
73 | + :fetch ru_RU_yo.zip | |
74 | + :sys unzip ru_RU_yo.zip | |
75 | + :delete ru_RU_yo.zip | |
76 | + :move ru_RU_yo.aff ru_YO.aff | |
77 | + :move ru_RU_yo.dic ru_YO.dic | |
78 | + :move README_ru_RU_yo.txt README_ru_YO.txt | |
79 | + @if not os.path.exists('ru_YO.orig.aff'): | |
80 | + :copy ru_YO.aff ru_YO.orig.aff | |
81 | + @if not os.path.exists('ru_YO.orig.dic'): | |
82 | + :copy ru_YO.dic ru_YO.orig.dic | |
83 | + @if os.path.exists('ru_YO.diff'): | |
84 | + :sys patch <ru_YO.diff | |
85 | + | |
86 | + | |
87 | +# Generate diff files, so that others can get the OpenOffice files and apply | |
88 | +# the diffs to get the Vim versions. | |
89 | + | |
90 | +diff: | |
91 | + :assertpkg diff | |
92 | + :sys {force} diff -a -C 1 ru_RU.orig.aff ru_RU.aff >ru_RU.diff | |
93 | + :sys {force} diff -a -C 1 ru_RU.orig.dic ru_RU.dic >>ru_RU.diff | |
94 | + :sys {force} diff -a -C 1 ru_IE.orig.aff ru_IE.aff >ru_IE.diff | |
95 | + :sys {force} diff -a -C 1 ru_IE.orig.dic ru_IE.dic >>ru_IE.diff | |
96 | + :sys {force} diff -a -C 1 ru_YO.orig.aff ru_YO.aff >ru_YO.diff | |
97 | + :sys {force} diff -a -C 1 ru_YO.orig.dic ru_YO.dic >>ru_YO.diff | |
98 | + | |
99 | + | |
100 | +# Check for updated spell files. When there are changes the | |
101 | +# ".new.aff" and ".new.dic" files are left behind for manual inspection. | |
102 | + | |
103 | +check: | |
104 | + :print Doesn't work yet. |
@@ -0,0 +1,32 @@ | ||
1 | +*** ru_RU.orig.dic Sat Aug 27 22:54:55 2005 | |
2 | +--- ru_RU.dic Sun Aug 28 11:46:34 2005 | |
3 | +*************** | |
4 | +*** 8767,8769 **** | |
5 | + ÂÌÅËÌÏÓÔØ/F | |
6 | +- ÂÌÅËÌÙÊ/A | |
7 | + ÂÌÅËÌÙÊ/AZ | |
8 | +--- 8767,8768 ---- | |
9 | +*************** | |
10 | +*** 98086,98088 **** | |
11 | + ÒÁÚÒÑÖÅÎÎÙÊ/AES | |
12 | +- ÒÁÚÒÑÖÅÎÎÙÊ/AS | |
13 | + ÒÁÚÕÂÅÄÉ×ÛÉÊ/A | |
14 | +--- 98085,98086 ---- | |
15 | +*************** | |
16 | +*** 115007,115009 **** | |
17 | + ÔÏÌËÉ/B | |
18 | +- ÔÏÌËÉ/O | |
19 | + ÔÏÌËÌÁ/L | |
20 | +--- 115005,115006 ---- | |
21 | +*************** | |
22 | +*** 119209,119211 **** | |
23 | + ÕÎÉÖÅÎÎÙÊ/ASX | |
24 | +- ÕÎÉÖÅÎÎÙÊ/AX | |
25 | + ÕÎÉÚÁ×ÛÉÊ/A | |
26 | +--- 119206,119207 ---- | |
27 | +*************** | |
28 | +*** 120603,120605 **** | |
29 | + ÕÔÏÎÞÅÎÎÙÊ/ASX | |
30 | +- ÕÔÏÎÞÅÎÎÙÊ/AX | |
31 | + ÕÔÏÐ/L | |
32 | +--- 120599,120600 ---- |
@@ -0,0 +1,14 @@ | ||
1 | +*** ru_YO.orig.dic Sat Aug 27 22:54:55 2005 | |
2 | +--- ru_YO.dic Sun Aug 28 11:46:58 2005 | |
3 | +*************** | |
4 | +*** 86471,86473 **** | |
5 | + ÐÏÞÔ£ÎÎÙÊ/AS | |
6 | +- ÐÏÞÔÉ | |
7 | + ÐÏÞÔÉ/B | |
8 | +--- 86471,86472 ---- | |
9 | +*************** | |
10 | +*** 115246,115248 **** | |
11 | + ÔÏÌËÉ/B | |
12 | +- ÔÏÌËÉ/O | |
13 | + ÔÏÌËÌÁ/L | |
14 | +--- 115245,115246 ---- |
@@ -10043,6 +10043,9 @@ | ||
10043 | 10043 | #ifdef FEAT_CSCOPE |
10044 | 10044 | "cscope", |
10045 | 10045 | #endif |
10046 | +#ifdef CURSOR_SHAPE | |
10047 | + "cursorshape", | |
10048 | +#endif | |
10046 | 10049 | #ifdef DEBUG |
10047 | 10050 | "debug", |
10048 | 10051 | #endif |
@@ -1081,7 +1081,8 @@ | ||
1081 | 1081 | |
1082 | 1082 | /* GUI and some consoles can change the shape of the cursor. The code is also |
1083 | 1083 | * needed for the 'mouseshape' option. */ |
1084 | -#if defined(FEAT_GUI) || defined(MCH_CURSOR_SHAPE) || defined(FEAT_MOUSESHAPE) | |
1084 | +#if defined(FEAT_GUI) || defined(MCH_CURSOR_SHAPE) || defined(FEAT_MOUSESHAPE) \ | |
1085 | + || (defined(UNIX) && defined(FEAT_NORMAL)) | |
1085 | 1086 | # define CURSOR_SHAPE |
1086 | 1087 | #endif |
1087 | 1088 |
@@ -6865,6 +6865,10 @@ | ||
6865 | 6865 | if (got_int) |
6866 | 6866 | return; |
6867 | 6867 | msg_outtrans(ac->cmd); |
6868 | +#ifdef FEAT_EVAL | |
6869 | + if (p_verbose > 0) | |
6870 | + last_set_msg(ac->scriptID); | |
6871 | +#endif | |
6868 | 6872 | if (got_int) |
6869 | 6873 | return; |
6870 | 6874 | if (ac->next != NULL) |
@@ -460,10 +460,12 @@ | ||
460 | 460 | /* |
461 | 461 | * Send the command to target interpreter by appending it to the |
462 | 462 | * comm window in the communication window. |
463 | + * Length must be computed exactly! | |
463 | 464 | */ |
464 | - length = STRLEN(name) + STRLEN(cmd) + 14; | |
465 | 465 | #ifdef FEAT_MBYTE |
466 | - length += STRLEN(p_enc); | |
466 | + length = STRLEN(name) + STRLEN(p_enc) + STRLEN(cmd) + 14; | |
467 | +#else | |
468 | + length = STRLEN(name) + STRLEN(cmd) + 10; | |
467 | 469 | #endif |
468 | 470 | property = (char_u *)alloc((unsigned)length + 30); |
469 | 471 |
@@ -480,6 +482,7 @@ | ||
480 | 482 | serial++; |
481 | 483 | sprintf((char *)property + length, "%c-r %x %d", |
482 | 484 | 0, (int_u)commWindow, serial); |
485 | + /* Add length of what "-r %x %d" resulted in, skipping the NUL. */ | |
483 | 486 | length += STRLEN(property + length + 1) + 1; |
484 | 487 | |
485 | 488 | res = AppendPropCarefully(dpy, w, commProperty, property, length + 1); |
@@ -787,9 +790,10 @@ | ||
787 | 790 | if (!WindowValid(dpy, win)) |
788 | 791 | return -1; |
789 | 792 | |
790 | - length = STRLEN(str) + 11; | |
791 | 793 | #ifdef FEAT_MBYTE |
792 | - length += STRLEN(p_enc); | |
794 | + length = STRLEN(p_enc) + STRLEN(str) + 14; | |
795 | +#else | |
796 | + length = STRLEN(str) + 10; | |
793 | 797 | #endif |
794 | 798 | if ((property = (char_u *)alloc((unsigned)length + 30)) != NULL) |
795 | 799 | { |
@@ -800,6 +804,7 @@ | ||
800 | 804 | sprintf((char *)property, "%cn%c-n %s%c-w %x", |
801 | 805 | 0, 0, str, 0, (unsigned int)commWindow); |
802 | 806 | #endif |
807 | + /* Add length of what "%x" resulted in. */ | |
803 | 808 | length += STRLEN(property + length); |
804 | 809 | res = AppendPropCarefully(dpy, win, commProperty, property, length + 1); |
805 | 810 | vim_free(property); |
@@ -1268,11 +1273,12 @@ | ||
1268 | 1273 | ga_grow(&reply, 50 + STRLEN(p_enc)); |
1269 | 1274 | sprintf(reply.ga_data, "%cr%c-E %s%c-s %s%c-r ", |
1270 | 1275 | 0, 0, p_enc, 0, serial, 0); |
1276 | + reply.ga_len = 14 + STRLEN(serial); | |
1271 | 1277 | #else |
1272 | 1278 | ga_grow(&reply, 50); |
1273 | 1279 | sprintf(reply.ga_data, "%cr%c-s %s%c-r ", 0, 0, serial, 0); |
1280 | + reply.ga_len = 10 + STRLEN(serial); | |
1274 | 1281 | #endif |
1275 | - reply.ga_len = 10 + STRLEN(serial); | |
1276 | 1282 | } |
1277 | 1283 | res = NULL; |
1278 | 1284 | if (serverName != NULL && STRICMP(name, serverName) == 0) |
@@ -2706,17 +2706,37 @@ | ||
2706 | 2706 | mb_charlen(str) |
2707 | 2707 | char_u *str; |
2708 | 2708 | { |
2709 | - int count; | |
2710 | - | |
2711 | - if (str == NULL) | |
2709 | + char_u *p = str; | |
2710 | + int count; | |
2711 | + | |
2712 | + if (p == NULL) | |
2712 | 2713 | return 0; |
2713 | 2714 | |
2714 | - for (count = 0; *str != NUL; count++) | |
2715 | - str += (*mb_ptr2len)(str); | |
2715 | + for (count = 0; *p != NUL; count++) | |
2716 | + p += (*mb_ptr2len)(p); | |
2716 | 2717 | |
2717 | 2718 | return count; |
2718 | 2719 | } |
2719 | 2720 | |
2721 | +#if defined(FEAT_SYN_HL) || defined(PROTO) | |
2722 | +/* | |
2723 | + * Like mb_charlen() but for a string with specified length. | |
2724 | + */ | |
2725 | + int | |
2726 | +mb_charlen_len(str, len) | |
2727 | + char_u *str; | |
2728 | + int len; | |
2729 | +{ | |
2730 | + char_u *p = str; | |
2731 | + int count; | |
2732 | + | |
2733 | + for (count = 0; *p != NUL && p < str + len; count++) | |
2734 | + p += (*mb_ptr2len)(p); | |
2735 | + | |
2736 | + return count; | |
2737 | +} | |
2738 | +#endif | |
2739 | + | |
2720 | 2740 | /* |
2721 | 2741 | * Try to un-escape a multi-byte character. |
2722 | 2742 | * Used for the "to" and "from" part of a mapping. |
@@ -1664,7 +1664,7 @@ | ||
1664 | 1664 | |
1665 | 1665 | /* |
1666 | 1666 | * Search for last occurrence of "c" in "string". |
1667 | - * return NULL if not found. | |
1667 | + * Return NULL if not found. | |
1668 | 1668 | * Does not handle multi-byte char for "c"! |
1669 | 1669 | */ |
1670 | 1670 | char_u * |
@@ -3289,6 +3289,8 @@ | ||
3289 | 3289 | return NULL; |
3290 | 3290 | } |
3291 | 3291 | |
3292 | +# if defined(MCH_CURSOR_SHAPE) || defined(FEAT_GUI) \ | |
3293 | + || defined(FEAT_MOUSESHAPE) || defined(PROTO) | |
3292 | 3294 | /* |
3293 | 3295 | * Return the index into shape_table[] for the current mode. |
3294 | 3296 | * When "mouse" is TRUE, consider indexes valid for the mouse pointer. |
@@ -3346,6 +3348,7 @@ | ||
3346 | 3348 | #endif |
3347 | 3349 | return SHAPE_IDX_N; |
3348 | 3350 | } |
3351 | +#endif | |
3349 | 3352 | |
3350 | 3353 | # if defined(FEAT_MOUSESHAPE) || defined(PROTO) |
3351 | 3354 | static int old_mouse_shape = 0; |
@@ -3257,6 +3257,8 @@ | ||
3257 | 3257 | |
3258 | 3258 | #if !((defined(MSDOS) || defined(OS2) || defined(WIN3264)) && !defined(FEAT_GUI)) |
3259 | 3259 | { |
3260 | + char_u *p; | |
3261 | + | |
3260 | 3262 | /* |
3261 | 3263 | * If 'background' wasn't set by the user, try guessing the value, |
3262 | 3264 | * depending on the terminal name. Only need to check for terminals |
@@ -3264,16 +3266,24 @@ | ||
3264 | 3266 | * "linux" Linux console |
3265 | 3267 | * "screen.linux" Linux console with screen |
3266 | 3268 | * "cygwin" Cygwin shell |
3269 | + * We also check the COLORFGBG environment variable, which is set by | |
3270 | + * rxvt and derivatives. This variable contains either two or three | |
3271 | + * values separated by semicolons; we want the last value in either | |
3272 | + * case. If this value is 0-6 or 8, our background is dark. | |
3267 | 3273 | */ |
3268 | 3274 | idx = findoption((char_u *)"bg"); |
3269 | 3275 | if (!(options[idx].flags & P_WAS_SET) |
3270 | 3276 | && (STRCMP(T_NAME, "linux") == 0 |
3271 | 3277 | || STRCMP(T_NAME, "screen.linux") == 0 |
3272 | - || STRCMP(T_NAME, "cygwin") == 0)) | |
3278 | + || STRCMP(T_NAME, "cygwin") == 0 | |
3279 | + || ((p = mch_getenv("COLORFGBG")) != NULL | |
3280 | + && (p = vim_strrchr(p, ';')) != NULL | |
3281 | + && ((p[1] >= '0' && p[1] <= '6') || p[1] == '8') | |
3282 | + && p[2] == NUL))) | |
3273 | 3283 | { |
3274 | 3284 | set_string_option_direct(NULL, idx, (char_u *)"dark", OPT_FREE); |
3275 | - /* don't mark it as set, when starting the GUI it may be changed | |
3276 | - * again */ | |
3285 | + /* don't mark it as set, when starting the GUI it may be | |
3286 | + * changed again */ | |
3277 | 3287 | options[idx].flags &= ~P_WAS_SET; |
3278 | 3288 | } |
3279 | 3289 | } |
@@ -9777,15 +9787,15 @@ | ||
9777 | 9787 | static void |
9778 | 9788 | fill_breakat_flags() |
9779 | 9789 | { |
9780 | - char_u *c; | |
9790 | + char_u *p; | |
9781 | 9791 | int i; |
9782 | 9792 | |
9783 | 9793 | for (i = 0; i < 256; i++) |
9784 | 9794 | breakat_flags[i] = FALSE; |
9785 | 9795 | |
9786 | 9796 | if (p_breakat != NULL) |
9787 | - for (c = p_breakat; *c; c++) | |
9788 | - breakat_flags[*c] = TRUE; | |
9797 | + for (p = p_breakat; *p; p++) | |
9798 | + breakat_flags[*p] = TRUE; | |
9789 | 9799 | } |
9790 | 9800 | |
9791 | 9801 | # if defined(__BORLANDC__) && (__BORLANDC__ < 0x500) |
@@ -55,6 +55,7 @@ | ||
55 | 55 | void mb_adjustpos __ARGS((pos_T *lp)); |
56 | 56 | char_u *mb_prevptr __ARGS((char_u *line, char_u *p)); |
57 | 57 | int mb_charlen __ARGS((char_u *str)); |
58 | +int mb_charlen_len __ARGS((char_u *str, int len)); | |
58 | 59 | char_u *mb_unescape __ARGS((char_u **pp)); |
59 | 60 | int mb_lefthalve __ARGS((int row, int col)); |
60 | 61 | int mb_fix_col __ARGS((int col, int row)); |
@@ -214,9 +214,9 @@ | ||
214 | 214 | * WF_REGION <region> follows |
215 | 215 | * WF_AFX <affixID> follows |
216 | 216 | * |
217 | - * <flags2> 1 byte Only used when there are postponed prefixes. | |
218 | - * Bitmask of: | |
217 | + * <flags2> 1 byte Bitmask of: | |
219 | 218 | * WF_HAS_AFF >> 8 word includes affix |
219 | + * WF_NEEDCOMP >> 8 word only valid in compound | |
220 | 220 | * |
221 | 221 | * <pflags> 1 byte bitmask of: |
222 | 222 | * WFP_RARE rare prefix |
@@ -273,6 +273,7 @@ | ||
273 | 273 | |
274 | 274 | /* for <flags2>, shifted up one byte to be used in wn_flags */ |
275 | 275 | #define WF_HAS_AFF 0x0100 /* word includes affix */ |
276 | +#define WF_NEEDCOMP 0x0200 /* word only valid in compound */ | |
276 | 277 | |
277 | 278 | #define WF_CAPMASK (WF_ONECAP | WF_ALLCAP | WF_KEEPCAP | WF_FIXCAP) |
278 | 279 |
@@ -754,7 +755,7 @@ | ||
754 | 755 | static int soundalike_score __ARGS((char_u *goodsound, char_u *badsound)); |
755 | 756 | static int spell_edit_score __ARGS((char_u *badword, char_u *goodword)); |
756 | 757 | static void dump_word __ARGS((char_u *word, int round, int flags, linenr_T lnum)); |
757 | -static linenr_T apply_prefixes __ARGS((slang_T *slang, char_u *word, int round, int flags, linenr_T startlnum)); | |
758 | +static linenr_T dump_prefixes __ARGS((slang_T *slang, char_u *word, int round, int flags, linenr_T startlnum)); | |
758 | 759 | |
759 | 760 | /* |
760 | 761 | * Use our own character-case definitions, because the current locale may |
@@ -834,6 +835,7 @@ | ||
834 | 835 | int nrlen = 0; /* found a number first */ |
835 | 836 | int c; |
836 | 837 | int wrongcaplen = 0; |
838 | + int lpi; | |
837 | 839 | |
838 | 840 | /* A word never starts at a space or a control character. Return quickly |
839 | 841 | * then, skipping over the character. */ |
@@ -907,9 +909,15 @@ | ||
907 | 909 | * We check them all, because a matching word may be longer than an |
908 | 910 | * already found matching word. |
909 | 911 | */ |
910 | - for (mi.mi_lp = LANGP_ENTRY(wp->w_buffer->b_langp, 0); | |
911 | - mi.mi_lp->lp_slang != NULL; ++mi.mi_lp) | |
912 | - { | |
912 | + for (lpi = 0; lpi < wp->w_buffer->b_langp.ga_len; ++lpi) | |
913 | + { | |
914 | + mi.mi_lp = LANGP_ENTRY(wp->w_buffer->b_langp, lpi); | |
915 | + | |
916 | + /* If reloading fails the language is still in the list but everything | |
917 | + * has been cleared. */ | |
918 | + if (mi.mi_lp->lp_slang->sl_fidxs == NULL) | |
919 | + continue; | |
920 | + | |
913 | 921 | /* Check for a matching word in case-folded words. */ |
914 | 922 | find_word(&mi, FIND_FOLDWORD); |
915 | 923 |
@@ -973,23 +981,26 @@ | ||
973 | 981 | /* First language in 'spelllang' is NOBREAK. Find first position |
974 | 982 | * at which any word would be valid. */ |
975 | 983 | mi.mi_lp = LANGP_ENTRY(wp->w_buffer->b_langp, 0); |
976 | - p = mi.mi_word; | |
977 | - fp = mi.mi_fword; | |
978 | - for (;;) | |
979 | - { | |
980 | - mb_ptr_adv(p); | |
981 | - mb_ptr_adv(fp); | |
982 | - if (p >= mi.mi_end) | |
983 | - break; | |
984 | - mi.mi_compoff = fp - mi.mi_fword; | |
985 | - find_word(&mi, FIND_COMPOUND); | |
986 | - if (mi.mi_result != SP_BAD) | |
987 | - { | |
988 | - mi.mi_end = p; | |
989 | - break; | |
990 | - } | |
991 | - } | |
992 | - mi.mi_result = save_result; | |
984 | + if (mi.mi_lp->lp_slang->sl_fidxs != NULL) | |
985 | + { | |
986 | + p = mi.mi_word; | |
987 | + fp = mi.mi_fword; | |
988 | + for (;;) | |
989 | + { | |
990 | + mb_ptr_adv(p); | |
991 | + mb_ptr_adv(fp); | |
992 | + if (p >= mi.mi_end) | |
993 | + break; | |
994 | + mi.mi_compoff = fp - mi.mi_fword; | |
995 | + find_word(&mi, FIND_COMPOUND); | |
996 | + if (mi.mi_result != SP_BAD) | |
997 | + { | |
998 | + mi.mi_end = p; | |
999 | + break; | |
1000 | + } | |
1001 | + } | |
1002 | + mi.mi_result = save_result; | |
1003 | + } | |
993 | 1004 | } |
994 | 1005 | |
995 | 1006 | if (mi.mi_result == SP_BAD || mi.mi_result == SP_BANNED) |
@@ -1284,6 +1295,15 @@ | ||
1284 | 1295 | if (((unsigned)flags >> 24) == 0 |
1285 | 1296 | || wlen - mip->mi_compoff < slang->sl_compminlen) |
1286 | 1297 | continue; |
1298 | +#ifdef FEAT_MBYTE | |
1299 | + /* For multi-byte chars check character length against | |
1300 | + * COMPOUNDMIN. */ | |
1301 | + if (has_mbyte | |
1302 | + && slang->sl_compminlen < MAXWLEN | |
1303 | + && mb_charlen_len(mip->mi_word + mip->mi_compoff, | |
1304 | + wlen - mip->mi_compoff) < slang->sl_compminlen) | |
1305 | + continue; | |
1306 | +#endif | |
1287 | 1307 | |
1288 | 1308 | /* Limit the number of compound words to COMPOUNDMAX if no |
1289 | 1309 | * maximum for syllables is specified. */ |
@@ -1358,6 +1378,10 @@ | ||
1358 | 1378 | } |
1359 | 1379 | } |
1360 | 1380 | |
1381 | + /* Check NEEDCOMPOUND: can't use word without compounding. */ | |
1382 | + else if (flags & WF_NEEDCOMP) | |
1383 | + continue; | |
1384 | + | |
1361 | 1385 | nobreak_result = SP_OK; |
1362 | 1386 | |
1363 | 1387 | if (!word_ends) |
@@ -1762,7 +1786,8 @@ | ||
1762 | 1786 | |
1763 | 1787 | /* |
1764 | 1788 | * Move to next spell error. |
1765 | - * "curline" is TRUE for "z?": find word under/after cursor in the same line. | |
1789 | + * "curline" is FALSE for "[s", "]s", "[S" and "]S". | |
1790 | + * "curline" is TRUE to find word under/after cursor in the same line. | |
1766 | 1791 | * For Insert mode completion "dir" is BACKWARD and "curline" is TRUE: move |
1767 | 1792 | * to after badly spelled word before the cursor. |
1768 | 1793 | * Return 0 if not found, length of the badly spelled word otherwise. |
@@ -1771,7 +1796,7 @@ | ||
1771 | 1796 | spell_move_to(wp, dir, allwords, curline, attrp) |
1772 | 1797 | win_T *wp; |
1773 | 1798 | int dir; /* FORWARD or BACKWARD */ |
1774 | - int allwords; /* TRUE for "[s" and "]s" */ | |
1799 | + int allwords; /* TRUE for "[s"/"]s", FALSE for "[S"/"]S" */ | |
1775 | 1800 | int curline; |
1776 | 1801 | int *attrp; /* return: attributes of bad word or NULL */ |
1777 | 1802 | { |
@@ -1790,6 +1815,8 @@ | ||
1790 | 1815 | int buflen = 0; |
1791 | 1816 | int skip = 0; |
1792 | 1817 | int capcol = -1; |
1818 | + int found_one = FALSE; | |
1819 | + int wrapped = FALSE; | |
1793 | 1820 | |
1794 | 1821 | if (no_spell_checking(wp)) |
1795 | 1822 | return 0; |
@@ -1840,9 +1867,11 @@ | ||
1840 | 1867 | endp = buf + len; |
1841 | 1868 | while (p < endp) |
1842 | 1869 | { |
1843 | - /* When searching backward don't search after the cursor. */ | |
1870 | + /* When searching backward don't search after the cursor. Unless | |
1871 | + * we wrapped around the end of the buffer. */ | |
1844 | 1872 | if (dir == BACKWARD |
1845 | 1873 | && lnum == wp->w_cursor.lnum |
1874 | + && !wrapped | |
1846 | 1875 | && (colnr_T)(p - buf) >= wp->w_cursor.col) |
1847 | 1876 | break; |
1848 | 1877 |
@@ -1855,14 +1884,17 @@ | ||
1855 | 1884 | /* We found a bad word. Check the attribute. */ |
1856 | 1885 | if (allwords || attr == highlight_attr[HLF_SPB]) |
1857 | 1886 | { |
1887 | + found_one = TRUE; | |
1888 | + | |
1858 | 1889 | /* When searching forward only accept a bad word after |
1859 | 1890 | * the cursor. */ |
1860 | 1891 | if (dir == BACKWARD |
1861 | - || lnum > wp->w_cursor.lnum | |
1892 | + || lnum != wp->w_cursor.lnum | |
1862 | 1893 | || (lnum == wp->w_cursor.lnum |
1863 | - && (colnr_T)(curline ? p - buf + len | |
1894 | + && (wrapped | |
1895 | + || (colnr_T)(curline ? p - buf + len | |
1864 | 1896 | : p - buf) |
1865 | - > wp->w_cursor.col)) | |
1897 | + > wp->w_cursor.col))) | |
1866 | 1898 | { |
1867 | 1899 | if (has_syntax) |
1868 | 1900 | { |
@@ -1906,7 +1938,7 @@ | ||
1906 | 1938 | |
1907 | 1939 | if (dir == BACKWARD && found_pos.lnum != 0) |
1908 | 1940 | { |
1909 | - /* Use the last match in the line. */ | |
1941 | + /* Use the last match in the line (before the cursor). */ | |
1910 | 1942 | wp->w_cursor = found_pos; |
1911 | 1943 | vim_free(buf); |
1912 | 1944 | return found_len; |
@@ -1918,16 +1950,42 @@ | ||
1918 | 1950 | /* Advance to next line. */ |
1919 | 1951 | if (dir == BACKWARD) |
1920 | 1952 | { |
1921 | - if (lnum == 1) | |
1953 | + /* If we are back at the starting line and searched it again there | |
1954 | + * is no match, give up. */ | |
1955 | + if (lnum == wp->w_cursor.lnum && wrapped) | |
1922 | 1956 | break; |
1923 | - --lnum; | |
1957 | + | |
1958 | + if (lnum > 1) | |
1959 | + --lnum; | |
1960 | + else if (!p_ws) | |
1961 | + break; /* at first line and 'nowrapscan' */ | |
1962 | + else | |
1963 | + { | |
1964 | + /* Wrap around to the end of the buffer. May search the | |
1965 | + * starting line again and accept the last match. */ | |
1966 | + lnum = wp->w_buffer->b_ml.ml_line_count; | |
1967 | + wrapped = TRUE; | |
1968 | + } | |
1924 | 1969 | capcol = -1; |
1925 | 1970 | } |
1926 | 1971 | else |
1927 | 1972 | { |
1928 | - if (lnum == wp->w_buffer->b_ml.ml_line_count) | |
1973 | + if (lnum < wp->w_buffer->b_ml.ml_line_count) | |
1974 | + ++lnum; | |
1975 | + else if (!p_ws) | |
1976 | + break; /* at first line and 'nowrapscan' */ | |
1977 | + else | |
1978 | + { | |
1979 | + /* Wrap around to the start of the buffer. May search the | |
1980 | + * starting line again and accept the first match. */ | |
1981 | + lnum = 1; | |
1982 | + wrapped = TRUE; | |
1983 | + } | |
1984 | + | |
1985 | + /* If we are back at the starting line and there is no match then | |
1986 | + * give up. */ | |
1987 | + if (lnum == wp->w_cursor.lnum && !found_one) | |
1929 | 1988 | break; |
1930 | - ++lnum; | |
1931 | 1989 | |
1932 | 1990 | /* Skip the characters at the start of the next line that were |
1933 | 1991 | * included in a match crossing line boundaries. */ |
@@ -2450,10 +2508,8 @@ | ||
2450 | 2508 | /* truncating the name signals the error to spell_load_lang() */ |
2451 | 2509 | *lang = NUL; |
2452 | 2510 | if (lp != NULL && old_lp == NULL) |
2453 | - { | |
2454 | 2511 | slang_free(lp); |
2455 | - lp = NULL; | |
2456 | - } | |
2512 | + lp = NULL; | |
2457 | 2513 | |
2458 | 2514 | endOK: |
2459 | 2515 | if (fd != NULL) |
@@ -2885,7 +2941,7 @@ | ||
2885 | 2941 | --todo; |
2886 | 2942 | c = getc(fd); /* <compminlen> */ |
2887 | 2943 | if (c < 1) |
2888 | - c = 3; | |
2944 | + c = MAXWLEN; | |
2889 | 2945 | slang->sl_compminlen = c; |
2890 | 2946 | |
2891 | 2947 | --todo; |
@@ -2972,7 +3028,7 @@ | ||
2972 | 3028 | } |
2973 | 3029 | else /* normal char, "[abc]" and '*' are copied as-is */ |
2974 | 3030 | { |
2975 | - if (c == '+') | |
3031 | + if (c == '+' || c == '~') | |
2976 | 3032 | *pp++ = '\\'; /* "a+" becomes "a\+" */ |
2977 | 3033 | #ifdef FEAT_MBYTE |
2978 | 3034 | if (enc_utf8) |
@@ -3594,10 +3650,11 @@ | ||
3594 | 3650 | |
3595 | 3651 | /* If it was already found above then skip it. */ |
3596 | 3652 | for (c = 0; c < ga.ga_len; ++c) |
3597 | - if (fullpathcmp(spf_name, | |
3598 | - LANGP_ENTRY(ga, c)->lp_slang->sl_fname, | |
3599 | - FALSE) == FPC_SAME) | |
3653 | + { | |
3654 | + p = LANGP_ENTRY(ga, c)->lp_slang->sl_fname; | |
3655 | + if (p != NULL && fullpathcmp(spf_name, p, FALSE) == FPC_SAME) | |
3600 | 3656 | break; |
3657 | + } | |
3601 | 3658 | if (c < ga.ga_len) |
3602 | 3659 | continue; |
3603 | 3660 | } |
@@ -3646,15 +3703,6 @@ | ||
3646 | 3703 | } |
3647 | 3704 | } |
3648 | 3705 | |
3649 | - /* Add a NULL entry to mark the end of the list. */ | |
3650 | - if (ga_grow(&ga, 1) == FAIL) | |
3651 | - { | |
3652 | - ga_clear(&ga); | |
3653 | - return e_outofmem; | |
3654 | - } | |
3655 | - LANGP_ENTRY(ga, ga.ga_len)->lp_slang = NULL; | |
3656 | - ++ga.ga_len; | |
3657 | - | |
3658 | 3706 | /* Everything is fine, store the new b_langp value. */ |
3659 | 3707 | ga_clear(&buf->b_langp); |
3660 | 3708 | buf->b_langp = ga; |
@@ -3934,13 +3982,17 @@ | ||
3934 | 3982 | int didit = FALSE; |
3935 | 3983 | |
3936 | 3984 | for (lp = first_lang; lp != NULL; lp = lp->sl_next) |
3985 | + { | |
3937 | 3986 | if (fullpathcmp(fname, lp->sl_fname, FALSE) == FPC_SAME) |
3938 | 3987 | { |
3939 | 3988 | slang_clear(lp); |
3940 | - (void)spell_load_file(fname, NULL, lp, FALSE); | |
3989 | + if (spell_load_file(fname, NULL, lp, FALSE) == NULL) | |
3990 | + /* reloading failed, clear the language */ | |
3991 | + slang_clear(lp); | |
3941 | 3992 | redraw_all_later(NOT_VALID); |
3942 | 3993 | didit = TRUE; |
3943 | 3994 | } |
3995 | + } | |
3944 | 3996 | |
3945 | 3997 | /* When "zg" was used and the file wasn't loaded yet, should redo |
3946 | 3998 | * 'spelllang' to get it loaded. */ |
@@ -3967,6 +4019,7 @@ | ||
3967 | 4019 | unsigned af_kep; /* KEP ID for keep-case word */ |
3968 | 4020 | unsigned af_bad; /* BAD ID for banned word */ |
3969 | 4021 | unsigned af_needaffix; /* NEEDAFFIX ID */ |
4022 | + unsigned af_needcomp; /* NEEDCOMPOUND ID */ | |
3970 | 4023 | int af_pfxpostpone; /* postpone prefixes without chop string */ |
3971 | 4024 | hashtab_T af_pref; /* hashtable for prefixes, affheader_T */ |
3972 | 4025 | hashtab_T af_suff; /* hashtable for suffixes, affheader_T */ |
@@ -4129,13 +4182,14 @@ | ||
4129 | 4182 | garray_T si_prefcond; /* table with conditions for postponed |
4130 | 4183 | * prefixes, each stored as a string */ |
4131 | 4184 | int si_newprefID; /* current value for ah_newID */ |
4132 | - int si_compID; /* current value for compound ID */ | |
4185 | + int si_newcompID; /* current value for compound ID */ | |
4133 | 4186 | } spellinfo_T; |
4134 | 4187 | |
4135 | 4188 | static afffile_T *spell_read_aff __ARGS((spellinfo_T *spin, char_u *fname)); |
4136 | 4189 | static unsigned affitem2flag __ARGS((int flagtype, char_u *item, char_u *fname, int lnum)); |
4137 | 4190 | static unsigned get_affitem __ARGS((int flagtype, char_u **pp)); |
4138 | 4191 | static void process_compflags __ARGS((spellinfo_T *spin, afffile_T *aff, char_u *compflags)); |
4192 | +static void check_renumber __ARGS((spellinfo_T *spin)); | |
4139 | 4193 | static int flag_in_afflist __ARGS((int flagtype, char_u *afflist, unsigned flag)); |
4140 | 4194 | static void aff_check_number __ARGS((int spinval, int affval, char *name)); |
4141 | 4195 | static void aff_check_string __ARGS((char_u *spinval, char_u *affval, char *name)); |
@@ -4161,7 +4215,7 @@ | ||
4161 | 4215 | static void wordtree_compress __ARGS((spellinfo_T *spin, wordnode_T *root)); |
4162 | 4216 | static int node_compress __ARGS((spellinfo_T *spin, wordnode_T *node, hashtab_T *ht, int *tot)); |
4163 | 4217 | static int node_equal __ARGS((wordnode_T *n1, wordnode_T *n2)); |
4164 | -static void write_vim_spell __ARGS((spellinfo_T *spin, char_u *fname)); | |
4218 | +static int write_vim_spell __ARGS((spellinfo_T *spin, char_u *fname)); | |
4165 | 4219 | static void clear_node __ARGS((wordnode_T *node)); |
4166 | 4220 | static int put_node __ARGS((FILE *fd, wordnode_T *node, int index, int regionmask, int prefixtree)); |
4167 | 4221 | static void mkspell __ARGS((int fcount, char_u **fnames, int ascii, int overwrite, int added_word)); |
@@ -4445,7 +4499,9 @@ | ||
4445 | 4499 | smsg((char_u *)_("Invalid value for FLAG in %s line %d: %s"), |
4446 | 4500 | fname, lnum, items[1]); |
4447 | 4501 | if (aff->af_rar != 0 || aff->af_kep != 0 || aff->af_bad != 0 |
4448 | - || aff->af_needaffix != 0 || compflags != NULL | |
4502 | + || aff->af_needaffix != 0 | |
4503 | + || aff->af_needcomp != 0 | |
4504 | + || compflags != NULL | |
4449 | 4505 | || aff->af_suff.ht_used > 0 |
4450 | 4506 | || aff->af_pref.ht_used > 0) |
4451 | 4507 | smsg((char_u *)_("FLAG after using flags in %s line %d: %s"), |
@@ -4496,6 +4552,12 @@ | ||
4496 | 4552 | aff->af_needaffix = affitem2flag(aff->af_flagtype, items[1], |
4497 | 4553 | fname, lnum); |
4498 | 4554 | } |
4555 | + else if (STRCMP(items[0], "NEEDCOMPOUND") == 0 && itemcnt == 2 | |
4556 | + && aff->af_needcomp == 0) | |
4557 | + { | |
4558 | + aff->af_needcomp = affitem2flag(aff->af_flagtype, items[1], | |
4559 | + fname, lnum); | |
4560 | + } | |
4499 | 4561 | else if (STRCMP(items[0], "COMPOUNDFLAG") == 0 && itemcnt == 2 |
4500 | 4562 | && compflags == NULL) |
4501 | 4563 | { |
@@ -4608,8 +4670,9 @@ | ||
4608 | 4670 | if (cur_aff->ah_flag == aff->af_bad |
4609 | 4671 | || cur_aff->ah_flag == aff->af_rar |
4610 | 4672 | || cur_aff->ah_flag == aff->af_kep |
4611 | - || cur_aff->ah_flag == aff->af_needaffix) | |
4612 | - smsg((char_u *)_("Affix also used for BAD/RAR/KEP/NEEDAFFIX in %s line %d: %s"), | |
4673 | + || cur_aff->ah_flag == aff->af_needaffix | |
4674 | + || cur_aff->ah_flag == aff->af_needcomp) | |
4675 | + smsg((char_u *)_("Affix also used for BAD/RAR/KEP/NEEDAFFIX/NEEDCOMPOUND in %s line %d: %s"), | |
4613 | 4676 | fname, lnum, items[1]); |
4614 | 4677 | STRCPY(cur_aff->ah_key, items[1]); |
4615 | 4678 | hash_add(tp, cur_aff->ah_key); |
@@ -4643,6 +4706,7 @@ | ||
4643 | 4706 | { |
4644 | 4707 | /* Use a new number in the .spl file later, to be able |
4645 | 4708 | * to handle multiple .aff files. */ |
4709 | + check_renumber(spin); | |
4646 | 4710 | cur_aff->ah_newID = ++spin->si_newprefID; |
4647 | 4711 | |
4648 | 4712 | /* We only really use ah_newID if the prefix is |
@@ -5011,11 +5075,11 @@ | ||
5011 | 5075 | process_compflags(spin, aff, compflags); |
5012 | 5076 | |
5013 | 5077 | /* Check that we didn't use too many renumbered flags. */ |
5014 | - if (spin->si_compID < spin->si_newprefID) | |
5015 | - { | |
5016 | - if (spin->si_compID == 255) | |
5078 | + if (spin->si_newcompID < spin->si_newprefID) | |
5079 | + { | |
5080 | + if (spin->si_newcompID == 127 || spin->si_newcompID == 255) | |
5017 | 5081 | MSG(_("Too many postponed prefixes")); |
5018 | - else if (spin->si_newprefID == 0) | |
5082 | + else if (spin->si_newprefID == 0 || spin->si_newprefID == 127) | |
5019 | 5083 | MSG(_("Too many compound flags")); |
5020 | 5084 | else |
5021 | 5085 | MSG(_("Too many posponed prefixes and/or compound flags")); |
@@ -5199,8 +5263,9 @@ | ||
5199 | 5263 | * regexp (also inside []). */ |
5200 | 5264 | do |
5201 | 5265 | { |
5202 | - id = spin->si_compID--; | |
5203 | - } while (vim_strchr((char_u *)"/*+[]\\-^", id) != NULL); | |
5266 | + check_renumber(spin); | |
5267 | + id = spin->si_newcompID--; | |
5268 | + } while (vim_strchr((char_u *)"/+*[]\\-^", id) != NULL); | |
5204 | 5269 | ci->ci_newID = id; |
5205 | 5270 | hash_add(&aff->af_comp, ci->ci_key); |
5206 | 5271 | } |
@@ -5215,6 +5280,23 @@ | ||
5215 | 5280 | } |
5216 | 5281 | |
5217 | 5282 | /* |
5283 | + * Check that the new IDs for postponed affixes and compounding don't overrun | |
5284 | + * each other. We have almost 255 available, but start at 0-127 to avoid | |
5285 | + * using two bytes for utf-8. When the 0-127 range is used up go to 128-255. | |
5286 | + * When that is used up an error message is given. | |
5287 | + */ | |
5288 | + static void | |
5289 | +check_renumber(spin) | |
5290 | + spellinfo_T *spin; | |
5291 | +{ | |
5292 | + if (spin->si_newprefID == spin->si_newcompID && spin->si_newcompID < 128) | |
5293 | + { | |
5294 | + spin->si_newprefID = 127; | |
5295 | + spin->si_newcompID = 255; | |
5296 | + } | |
5297 | +} | |
5298 | + | |
5299 | +/* | |
5218 | 5300 | * Return TRUE if flag "flag" appears in affix list "afflist". |
5219 | 5301 | */ |
5220 | 5302 | static int |
@@ -5579,6 +5661,9 @@ | ||
5579 | 5661 | if (affile->af_needaffix != 0 && flag_in_afflist( |
5580 | 5662 | affile->af_flagtype, afflist, affile->af_needaffix)) |
5581 | 5663 | need_affix = TRUE; |
5664 | + if (affile->af_needcomp != 0 && flag_in_afflist( | |
5665 | + affile->af_flagtype, afflist, affile->af_needcomp)) | |
5666 | + flags |= WF_NEEDCOMP; | |
5582 | 5667 | |
5583 | 5668 | if (affile->af_pfxpostpone) |
5584 | 5669 | /* Need to store the list of prefix IDs with the word. */ |
@@ -6703,8 +6788,9 @@ | ||
6703 | 6788 | |
6704 | 6789 | /* |
6705 | 6790 | * Write the Vim .spl file "fname". |
6706 | - */ | |
6707 | - static void | |
6791 | + * Return FAIL or OK; | |
6792 | + */ | |
6793 | + static int | |
6708 | 6794 | write_vim_spell(spin, fname) |
6709 | 6795 | spellinfo_T *spin; |
6710 | 6796 | char_u *fname; |
@@ -6720,18 +6806,22 @@ | ||
6720 | 6806 | fromto_T *ftp; |
6721 | 6807 | char_u *p; |
6722 | 6808 | int rr; |
6809 | + int retval = OK; | |
6723 | 6810 | |
6724 | 6811 | fd = mch_fopen((char *)fname, "w"); |
6725 | 6812 | if (fd == NULL) |
6726 | 6813 | { |
6727 | 6814 | EMSG2(_(e_notopen), fname); |
6728 | - return; | |
6815 | + return FAIL; | |
6729 | 6816 | } |
6730 | 6817 | |
6731 | 6818 | /* <HEADER>: <fileID> <versionnr> */ |
6732 | 6819 | /* <fileID> */ |
6733 | 6820 | if (fwrite(VIMSPELLMAGIC, VIMSPELLMAGICL, (size_t)1, fd) != 1) |
6821 | + { | |
6734 | 6822 | EMSG(_(e_write)); |
6823 | + retval = FAIL; | |
6824 | + } | |
6735 | 6825 | putc(VIMSPELLVERSION, fd); /* <versionnr> */ |
6736 | 6826 | |
6737 | 6827 | /* |
@@ -6995,7 +7085,14 @@ | ||
6995 | 7085 | (void)put_node(fd, tree, 0, regionmask, round == 3); |
6996 | 7086 | } |
6997 | 7087 | |
6998 | - fclose(fd); | |
7088 | + /* Write another byte to check for errors. */ | |
7089 | + if (putc(0, fd) == EOF) | |
7090 | + retval = FAIL; | |
7091 | + | |
7092 | + if (fclose(fd) == EOF) | |
7093 | + retval = FAIL; | |
7094 | + | |
7095 | + return retval; | |
6999 | 7096 | } |
7000 | 7097 | |
7001 | 7098 | /* |
@@ -7221,7 +7318,7 @@ | ||
7221 | 7318 | ga_init2(&spin.si_sal, (int)sizeof(fromto_T), 20); |
7222 | 7319 | ga_init2(&spin.si_map, (int)sizeof(char_u), 100); |
7223 | 7320 | ga_init2(&spin.si_prefcond, (int)sizeof(char_u *), 50); |
7224 | - spin.si_compID = 255; /* start compound ID at maximum, going down */ | |
7321 | + spin.si_newcompID = 127; /* start compound ID at first maximum */ | |
7225 | 7322 | |
7226 | 7323 | /* default: fnames[0] is output file, following are input files */ |
7227 | 7324 | innames = &fnames[1]; |
@@ -7407,7 +7504,7 @@ | ||
7407 | 7504 | verbose_leave(); |
7408 | 7505 | } |
7409 | 7506 | |
7410 | - write_vim_spell(&spin, wfname); | |
7507 | + error = write_vim_spell(&spin, wfname) == FAIL; | |
7411 | 7508 | |
7412 | 7509 | if (spin.si_verbose || p_verbose > 2) |
7413 | 7510 | { |
@@ -7422,7 +7519,8 @@ | ||
7422 | 7519 | } |
7423 | 7520 | |
7424 | 7521 | /* If the file is loaded need to reload it. */ |
7425 | - spell_reload_one(wfname, added_word); | |
7522 | + if (!error) | |
7523 | + spell_reload_one(wfname, added_word); | |
7426 | 7524 | } |
7427 | 7525 | |
7428 | 7526 | /* Free the allocated memory. */ |
@@ -7602,7 +7700,7 @@ | ||
7602 | 7700 | { |
7603 | 7701 | char_u buf[MAXPATHL]; |
7604 | 7702 | int l; |
7605 | - slang_T *sl; | |
7703 | + char_u *fname; | |
7606 | 7704 | char_u *rtp; |
7607 | 7705 | char_u *lend; |
7608 | 7706 |
@@ -7624,12 +7722,14 @@ | ||
7624 | 7722 | { |
7625 | 7723 | /* Use the first language name from 'spelllang' and the |
7626 | 7724 | * encoding used in the first loaded .spl file. */ |
7627 | - sl = LANGP_ENTRY(curbuf->b_langp, 0)->lp_slang; | |
7725 | + fname = LANGP_ENTRY(curbuf->b_langp, 0)->lp_slang->sl_fname; | |
7726 | + if (fname == NULL) | |
7727 | + break; | |
7628 | 7728 | l = STRLEN(buf); |
7629 | 7729 | vim_snprintf((char *)buf + l, MAXPATHL - l, |
7630 | 7730 | "/spell/%.*s.%s.add", |
7631 | 7731 | (int)(lend - curbuf->b_p_spl), curbuf->b_p_spl, |
7632 | - strstr((char *)gettail(sl->sl_fname), ".ascii.") != NULL | |
7732 | + strstr((char *)gettail(fname), ".ascii.") != NULL | |
7633 | 7733 | ? (char_u *)"ascii" : spell_enc()); |
7634 | 7734 | set_option_value((char_u *)"spellfile", 0L, buf, OPT_LOCAL); |
7635 | 7735 | break; |
@@ -8976,6 +9076,7 @@ | ||
8976 | 9076 | int repextra = 0; /* extra bytes in fword[] from REP item */ |
8977 | 9077 | slang_T *slang; |
8978 | 9078 | int fword_ends; |
9079 | + int lpi; | |
8979 | 9080 | |
8980 | 9081 | /* We make a copy of the case-folded bad word, so that we can modify it |
8981 | 9082 | * to find matches (esp. REP items). Append some more text, changing |
@@ -8985,11 +9086,16 @@ | ||
8985 | 9086 | p = su->su_badptr + su->su_badlen; |
8986 | 9087 | (void)spell_casefold(p, STRLEN(p), fword + n, MAXWLEN - n); |
8987 | 9088 | |
8988 | - for (lp = LANGP_ENTRY(curwin->w_buffer->b_langp, 0); | |
8989 | - lp->lp_slang != NULL; ++lp) | |
8990 | - { | |
9089 | + for (lpi = 0; lpi < curwin->w_buffer->b_langp.ga_len; ++lpi) | |
9090 | + { | |
9091 | + lp = LANGP_ENTRY(curwin->w_buffer->b_langp, lpi); | |
8991 | 9092 | slang = lp->lp_slang; |
8992 | 9093 | |
9094 | + /* If reloading a spell file fails it's still in the list but | |
9095 | + * everything has been cleared. */ | |
9096 | + if (slang->sl_fbyts == NULL) | |
9097 | + continue; | |
9098 | + | |
8993 | 9099 | /* |
8994 | 9100 | * Go through the whole case-fold tree, try changes at each node. |
8995 | 9101 | * "tword[]" contains the word collected from nodes in the tree. |
@@ -9146,6 +9252,11 @@ | ||
9146 | 9252 | } |
9147 | 9253 | } |
9148 | 9254 | |
9255 | + /* Check NEEDCOMPOUND: can't use word without compounding. */ | |
9256 | + if (sp->ts_complen == sp->ts_compsplit && fword_ends | |
9257 | + && (flags & WF_NEEDCOMP)) | |
9258 | + break; | |
9259 | + | |
9149 | 9260 | if (sp->ts_complen > sp->ts_compsplit) |
9150 | 9261 | { |
9151 | 9262 | if (slang->sl_nobreak) |
@@ -9178,6 +9289,16 @@ | ||
9178 | 9289 | || sp->ts_twordlen - sp->ts_splitoff |
9179 | 9290 | < slang->sl_compminlen) |
9180 | 9291 | break; |
9292 | +#ifdef FEAT_MBYTE | |
9293 | + /* For multi-byte chars check character length against | |
9294 | + * COMPOUNDMIN. */ | |
9295 | + if (has_mbyte | |
9296 | + && slang->sl_compminlen < MAXWLEN | |
9297 | + && mb_charlen(tword + sp->ts_splitoff) | |
9298 | + < slang->sl_compminlen) | |
9299 | + break; | |
9300 | +#endif | |
9301 | + | |
9181 | 9302 | compflags[sp->ts_complen] = ((unsigned)flags >> 24); |
9182 | 9303 | compflags[sp->ts_complen + 1] = NUL; |
9183 | 9304 | vim_strncpy(preword + sp->ts_prewordlen, |
@@ -9307,6 +9428,12 @@ | ||
9307 | 9428 | && ((unsigned)flags >> 24) != 0 |
9308 | 9429 | && sp->ts_twordlen - sp->ts_splitoff |
9309 | 9430 | >= slang->sl_compminlen |
9431 | +#ifdef FEAT_MBYTE | |
9432 | + && (!has_mbyte | |
9433 | + || slang->sl_compminlen == MAXWLEN | |
9434 | + || mb_charlen(tword + sp->ts_splitoff) | |
9435 | + >= slang->sl_compminlen) | |
9436 | +#endif | |
9310 | 9437 | && (slang->sl_compsylmax < MAXWLEN |
9311 | 9438 | || sp->ts_complen + 1 - sp->ts_compsplit |
9312 | 9439 | < slang->sl_compmax) |
@@ -10282,13 +10409,15 @@ | ||
10282 | 10409 | suggest_T *stp; |
10283 | 10410 | suggest_T *sstp; |
10284 | 10411 | int score; |
10412 | + int lpi; | |
10285 | 10413 | |
10286 | 10414 | if (ga_grow(&su->su_sga, su->su_ga.ga_len) == FAIL) |
10287 | 10415 | return; |
10288 | 10416 | |
10289 | 10417 | /* Use the sound-folding of the first language that supports it. */ |
10290 | - for (lp = LANGP_ENTRY(curwin->w_buffer->b_langp, 0); | |
10291 | - lp->lp_slang != NULL; ++lp) | |
10418 | + for (lpi = 0; lpi < curwin->w_buffer->b_langp.ga_len; ++lpi) | |
10419 | + { | |
10420 | + lp = LANGP_ENTRY(curwin->w_buffer->b_langp, lpi); | |
10292 | 10421 | if (lp->lp_slang->sl_sal.ga_len > 0) |
10293 | 10422 | { |
10294 | 10423 | /* soundfold the bad word */ |
@@ -10317,6 +10446,7 @@ | ||
10317 | 10446 | } |
10318 | 10447 | break; |
10319 | 10448 | } |
10449 | + } | |
10320 | 10450 | } |
10321 | 10451 | |
10322 | 10452 | /* |
@@ -10336,11 +10466,12 @@ | ||
10336 | 10466 | char_u *p; |
10337 | 10467 | char_u badsound[MAXWLEN]; |
10338 | 10468 | int round; |
10469 | + int lpi; | |
10339 | 10470 | |
10340 | 10471 | /* Add the alternate score to su_ga. */ |
10341 | - for (lp = LANGP_ENTRY(curwin->w_buffer->b_langp, 0); | |
10342 | - lp->lp_slang != NULL; ++lp) | |
10343 | - { | |
10472 | + for (lpi = 0; lpi < curwin->w_buffer->b_langp.ga_len; ++lpi) | |
10473 | + { | |
10474 | + lp = LANGP_ENTRY(curwin->w_buffer->b_langp, lpi); | |
10344 | 10475 | if (lp->lp_slang->sl_sal.ga_len > 0) |
10345 | 10476 | { |
10346 | 10477 | /* soundfold the bad word */ |
@@ -10483,11 +10614,12 @@ | ||
10483 | 10614 | int flags; |
10484 | 10615 | int sound_score; |
10485 | 10616 | int local_score; |
10617 | + int lpi; | |
10486 | 10618 | |
10487 | 10619 | /* Do this for all languages that support sound folding. */ |
10488 | - for (lp = LANGP_ENTRY(curwin->w_buffer->b_langp, 0); | |
10489 | - lp->lp_slang != NULL; ++lp) | |
10490 | - { | |
10620 | + for (lpi = 0; lpi < curwin->w_buffer->b_langp.ga_len; ++lpi) | |
10621 | + { | |
10622 | + lp = LANGP_ENTRY(curwin->w_buffer->b_langp, lpi); | |
10491 | 10623 | if (lp->lp_slang->sl_sal.ga_len > 0) |
10492 | 10624 | { |
10493 | 10625 | /* soundfold the bad word */ |
@@ -10940,10 +11072,11 @@ | ||
10940 | 11072 | suggest_T *stp; |
10941 | 11073 | char_u sal_badword[MAXWLEN]; |
10942 | 11074 | int i; |
10943 | - | |
10944 | - for (lp = LANGP_ENTRY(curwin->w_buffer->b_langp, 0); | |
10945 | - lp->lp_slang != NULL; ++lp) | |
10946 | - { | |
11075 | + int lpi; | |
11076 | + | |
11077 | + for (lpi = 0; lpi < curwin->w_buffer->b_langp.ga_len; ++lpi) | |
11078 | + { | |
11079 | + lp = LANGP_ENTRY(curwin->w_buffer->b_langp, lpi); | |
10947 | 11080 | if (lp->lp_slang->sl_sal.ga_len > 0) |
10948 | 11081 | { |
10949 | 11082 | /* soundfold the bad word */ |
@@ -11032,17 +11165,20 @@ | ||
11032 | 11165 | { |
11033 | 11166 | langp_T *lp; |
11034 | 11167 | char_u sound[MAXWLEN]; |
11168 | + int lpi; | |
11035 | 11169 | |
11036 | 11170 | if (curwin->w_p_spell && *curbuf->b_p_spl != NUL) |
11037 | 11171 | /* Use the sound-folding of the first language that supports it. */ |
11038 | - for (lp = LANGP_ENTRY(curwin->w_buffer->b_langp, 0); | |
11039 | - lp->lp_slang != NULL; ++lp) | |
11172 | + for (lpi = 0; lpi < curwin->w_buffer->b_langp.ga_len; ++lpi) | |
11173 | + { | |
11174 | + lp = LANGP_ENTRY(curwin->w_buffer->b_langp, lpi); | |
11040 | 11175 | if (lp->lp_slang->sl_sal.ga_len > 0) |
11041 | 11176 | { |
11042 | 11177 | /* soundfold the word */ |
11043 | 11178 | spell_soundfold(lp->lp_slang, word, FALSE, sound); |
11044 | 11179 | return vim_strsave(sound); |
11045 | 11180 | } |
11181 | + } | |
11046 | 11182 | |
11047 | 11183 | /* No language with sound folding, return word as-is. */ |
11048 | 11184 | return vim_strsave(word); |
@@ -12119,6 +12255,7 @@ | ||
12119 | 12255 | char_u *region_names = NULL; /* region names being used */ |
12120 | 12256 | int do_region = TRUE; /* dump region names and numbers */ |
12121 | 12257 | char_u *p; |
12258 | + int lpi; | |
12122 | 12259 | |
12123 | 12260 | if (no_spell_checking(curwin)) |
12124 | 12261 | return; |
@@ -12130,8 +12267,9 @@ | ||
12130 | 12267 | |
12131 | 12268 | /* Find out if we can support regions: All languages must support the same |
12132 | 12269 | * regions or none at all. */ |
12133 | - for (lp = LANGP_ENTRY(buf->b_langp, 0); lp->lp_slang != NULL; ++lp) | |
12134 | - { | |
12270 | + for (lpi = 0; lpi < buf->b_langp.ga_len; ++lpi) | |
12271 | + { | |
12272 | + lp = LANGP_ENTRY(buf->b_langp, lpi); | |
12135 | 12273 | p = lp->lp_slang->sl_regions; |
12136 | 12274 | if (p[0] != 0) |
12137 | 12275 | { |
@@ -12156,9 +12294,12 @@ | ||
12156 | 12294 | /* |
12157 | 12295 | * Loop over all files loaded for the entries in 'spelllang'. |
12158 | 12296 | */ |
12159 | - for (lp = LANGP_ENTRY(buf->b_langp, 0); lp->lp_slang != NULL; ++lp) | |
12160 | - { | |
12297 | + for (lpi = 0; lpi < buf->b_langp.ga_len; ++lpi) | |
12298 | + { | |
12299 | + lp = LANGP_ENTRY(buf->b_langp, lpi); | |
12161 | 12300 | slang = lp->lp_slang; |
12301 | + if (slang->sl_fbyts == NULL) /* reloading failed */ | |
12302 | + continue; | |
12162 | 12303 | |
12163 | 12304 | vim_snprintf((char *)IObuff, IOSIZE, "# file: %s", slang->sl_fname); |
12164 | 12305 | ml_append(lnum++, IObuff, (colnr_T)0, FALSE); |
@@ -12205,6 +12346,7 @@ | ||
12205 | 12346 | * Only use the word when the region matches. */ |
12206 | 12347 | flags = (int)idxs[n]; |
12207 | 12348 | if ((round == 2 || (flags & WF_KEEPCAP) == 0) |
12349 | + && (flags & WF_NEEDCOMP) == 0 | |
12208 | 12350 | && (do_region |
12209 | 12351 | || (flags & WF_REGION) == 0 |
12210 | 12352 | || (((unsigned)flags >> 16) |
@@ -12222,7 +12364,7 @@ | ||
12222 | 12364 | |
12223 | 12365 | /* Apply the prefix, if there is one. */ |
12224 | 12366 | if (c != 0) |
12225 | - lnum = apply_prefixes(slang, word, round, | |
12367 | + lnum = dump_prefixes(slang, word, round, | |
12226 | 12368 | flags, lnum); |
12227 | 12369 | } |
12228 | 12370 | } |
@@ -12302,7 +12444,7 @@ | ||
12302 | 12444 | * Return the updated line number. |
12303 | 12445 | */ |
12304 | 12446 | static linenr_T |
12305 | -apply_prefixes(slang, word, round, flags, startlnum) | |
12447 | +dump_prefixes(slang, word, round, flags, startlnum) | |
12306 | 12448 | slang_T *slang; |
12307 | 12449 | char_u *word; /* case-folded word */ |
12308 | 12450 | int round; |
@@ -6,63 +6,50 @@ | ||
6 | 6 | :" Don't want to depend on the locale from the environment |
7 | 7 | :set enc=latin1 |
8 | 8 | :e! |
9 | -:" First generate a .spl file from a .dic and a .aff file. | |
10 | -gg:/^affstart1/+1,/^affend1/-1w! Xtest.aff | |
11 | -gg:/^dicstart/+1,/^dicend/-1w! Xtest.dic | |
12 | -:mkspell! Xtest Xtest | |
13 | 9 | :" |
14 | -:" use that spell file | |
15 | -:set spl=Xtest.latin1.spl | |
16 | -:set spell | |
17 | -:func SpellTest() | |
18 | -/^test1: | |
19 | -normal ]smm | |
20 | -let str = spellbadword() | |
21 | -$put =str | |
22 | -normal `m | |
23 | -let lst = spellsuggest(str, 4) | |
24 | -$put =string(lst) | |
25 | -normal `m]smm | |
26 | -let str = spellbadword() | |
27 | -$put =str | |
28 | -normal `m | |
29 | -let lst = spellsuggest(str, 2) | |
30 | -$put =string(lst) | |
31 | -normal `m]smm | |
32 | -let str = spellbadword() | |
33 | -$put =str | |
34 | -normal `m | |
35 | -let lst = spellsuggest(str, 2) | |
36 | -$put =string(lst) | |
37 | -normal `m]smm | |
38 | -let str = spellbadword() | |
39 | -$put =str | |
40 | -normal `m | |
41 | -let lst = spellsuggest(str, 2) | |
42 | -$put =string(lst) | |
43 | -normal `m]smm | |
44 | -let str = spellbadword() | |
45 | -$put =str | |
46 | -normal `m | |
47 | -let lst = spellsuggest(str, 2) | |
48 | -$put =string(lst) | |
49 | -normal `m]smm | |
50 | -let str = spellbadword() | |
51 | -$put =str | |
52 | -normal `m | |
53 | -let lst = spellsuggest(str, 2) | |
54 | -$put =string(lst) | |
10 | +:" Function to test .aff/.dic with list of good and bad words. | |
11 | +:func TestOne(aff, dic) | |
12 | + set spellfile= | |
13 | + $put ='' | |
14 | + $put ='test '. a:aff . '-' . a:dic | |
15 | + " Generate a .spl file from a .dic and .aff file. | |
16 | + exe '1;/^' . a:aff . 'affstart/+1,/^' . a:aff . 'affend/-1w! Xtest.aff' | |
17 | + exe '1;/^' . a:dic . 'dicstart/+1,/^' . a:dic . 'dicend/-1w! Xtest.dic' | |
18 | + mkspell! Xtest Xtest | |
19 | + " use that spell file | |
20 | + set spl=Xtest.latin1.spl spell | |
21 | + " list all valid words | |
22 | + spelldump | |
23 | + %yank | |
24 | + quit | |
25 | + $put | |
26 | + $put ='-------' | |
27 | + " find all bad words and suggestions for them | |
28 | + exe '1;/^' . a:aff . 'good:' | |
29 | + normal 0f:]s | |
30 | + let prevbad = '' | |
31 | + while 1 | |
32 | + let bad = spellbadword() | |
33 | + if bad == '' || bad == prevbad || bad == 'badend' | |
34 | + break | |
35 | + endif | |
36 | + let prevbad = bad | |
37 | + let lst = spellsuggest(bad, 3) | |
38 | + normal mm | |
39 | + $put =bad | |
40 | + $put =string(lst) | |
41 | + normal `m]s | |
42 | + endwhile | |
55 | 43 | endfunc |
56 | -:call SpellTest() | |
57 | -:spelldump | |
58 | -1GyG:q | |
59 | -:$put | |
44 | +:" | |
45 | +:call TestOne('1', '1') | |
60 | 46 | :$put =soundfold('goobledygoook') |
61 | 47 | :$put =soundfold('kóopërÿnôven') |
62 | 48 | :$put =soundfold('oeverloos gezwets edale') |
63 | 49 | :" |
50 | +:" | |
64 | 51 | :" and now with SAL instead of SOFO items; test automatic reloading |
65 | -gg:/^affstart2/+1,/^affend2/-1w! Xtest.aff | |
52 | +gg:/^affstart_sal/+1,/^affend_sal/-1w! Xtest.aff | |
66 | 53 | :mkspell! Xtest Xtest |
67 | 54 | :$put =soundfold('goobledygoook') |
68 | 55 | :$put =soundfold('kóopërÿnôven') |
@@ -101,39 +88,16 @@ | ||
101 | 88 | :$put =str |
102 | 89 | :" |
103 | 90 | :" Postponed prefixes |
104 | -gg:/^affstart3/+1,/^affend3/-1w! Xtest.aff | |
105 | -:mkspell! Xtest Xtest | |
106 | -:set spellfile= | |
107 | -:set spl=Xtest.latin1.spl | |
108 | -:spelldump | |
109 | -1GyG:q | |
110 | -:$put | |
111 | -:call SpellTest() | |
91 | +:call TestOne('2', '1') | |
112 | 92 | :" |
113 | -:" Compounding | |
114 | -gg:/^compaffstart/+1,/^compaffend/-1w! Xtest.aff | |
115 | -gg:/^compdicstart/+1,/^compdicend/-1w! Xtest.dic | |
116 | -:mkspell! Xtest Xtest | |
117 | -:set spellfile= | |
118 | -:set spl=Xtest.latin1.spl | |
119 | -:spelldump | |
120 | -1GyG:q | |
121 | -:$put | |
122 | -/^comptest: | |
123 | -:for i in range(11) | |
124 | -normal ]smm | |
125 | -let str = spellbadword() | |
126 | -$put =str | |
127 | -normal `m | |
128 | -let lst = spellsuggest(str, 3) | |
129 | -$put =string(lst) | |
130 | -normal `m | |
131 | -endfor | |
93 | +:" Compound words | |
94 | +:call TestOne('3', '3') | |
95 | +:call TestOne('4', '4') | |
132 | 96 | :" |
133 | 97 | gg:/^test output:/,$wq! test.out |
134 | 98 | ENDTEST |
135 | 99 | |
136 | -affstart1 | |
100 | +1affstart | |
137 | 101 | SET ISO8859-1 |
138 | 102 | TRY esianrtolcdugmphbyfvkwjkqxz-ëéèêïîäàâöüû'ESIANRTOLCDUGMPHBYFVKWJKQXZ |
139 | 103 |
@@ -182,9 +146,27 @@ | ||
182 | 146 | MAP cç |
183 | 147 | MAP yÿý |
184 | 148 | MAP sß |
185 | -affend1 | |
149 | +1affend | |
186 | 150 | |
187 | -affstart2 | |
151 | +1good: wrong OK puts. Test the end | |
152 | +bad: inputs comment ok Ok. test déôl end the | |
153 | +badend | |
154 | + | |
155 | +1dicstart | |
156 | +123456 | |
157 | +test/NO | |
158 | +# comment | |
159 | +wrong | |
160 | +Comment | |
161 | +OK | |
162 | +uk | |
163 | +put/ISO | |
164 | +the end | |
165 | +deol | |
166 | +déôr | |
167 | +1dicend | |
168 | + | |
169 | +affstart_sal | |
188 | 170 | SET ISO8859-1 |
189 | 171 | TRY esianrtolcdugmphbyfvkwjkqxz-ëéèêïîäàâöüû'ESIANRTOLCDUGMPHBYFVKWJKQXZ |
190 | 172 |
@@ -338,9 +320,9 @@ | ||
338 | 320 | SAL Y(AEIOU)- Y |
339 | 321 | SAL ZZ- _ |
340 | 322 | SAL Z S |
341 | -affend2 | |
323 | +affend_sal | |
342 | 324 | |
343 | -affstart3 | |
325 | +2affstart | |
344 | 326 | SET ISO8859-1 |
345 | 327 | |
346 | 328 | FOL àáâãäåæçèéêëìíîïðñòóôõöøùúûüýþßÿ |
@@ -387,23 +369,47 @@ | ||
387 | 369 | MAP cç |
388 | 370 | MAP yÿý |
389 | 371 | MAP sß |
390 | -affend3 | |
372 | +2affend | |
391 | 373 | |
392 | -dicstart | |
393 | -123456 | |
394 | -test/NO | |
395 | -# comment | |
396 | -wrong | |
397 | -Comment | |
398 | -OK | |
399 | -uk | |
400 | -put/ISO | |
401 | -the end | |
402 | -deol | |
403 | -déôr | |
404 | -dicend | |
374 | +2good: puts | |
375 | +bad: inputs comment ok Ok end the. test déôl | |
376 | +badend | |
405 | 377 | |
406 | -compaffstart | |
378 | +addstart | |
379 | +/regions=usgbnz | |
380 | +elequint/2 | |
381 | +elekwint/3 | |
382 | +addend | |
383 | + | |
384 | +test2: | |
385 | +elequint test elekwint test elekwent asdf | |
386 | + | |
387 | +Test rules for compounding. | |
388 | + | |
389 | +3affstart | |
390 | +SET ISO8859-1 | |
391 | + | |
392 | +COMPOUNDMIN 3 | |
393 | +COMPOUNDFLAGS m* | |
394 | +NEEDCOMPOUND x | |
395 | +3affend | |
396 | + | |
397 | +3dicstart | |
398 | +1234 | |
399 | +foo/m | |
400 | +bar/mx | |
401 | +mï/m | |
402 | +la/mx | |
403 | +3dicend | |
404 | + | |
405 | +3good: foo mï foobar foofoobar barfoo barbarfoo | |
406 | +bad: bar la foomï barmï mïfoo mïbar mïmï lala mïla lamï foola labar | |
407 | +badend | |
408 | + | |
409 | + | |
410 | +Tests for compounding. | |
411 | + | |
412 | +4affstart | |
407 | 413 | SET ISO8859-1 |
408 | 414 | |
409 | 415 | FOL àáâãäåæçèéêëìíîïðñòóôõöøùúûüýþßÿ |
@@ -445,9 +451,9 @@ | ||
445 | 451 | |
446 | 452 | PFX p N 1 |
447 | 453 | PFX p 0 pre . |
448 | -compaffend | |
454 | +4affend | |
449 | 455 | |
450 | -compdicstart | |
456 | +4dicstart | |
451 | 457 | 1234 |
452 | 458 | word/m |
453 | 459 | util/am |
@@ -456,37 +462,16 @@ | ||
456 | 462 | bork/mp |
457 | 463 | start/s |
458 | 464 | end/e |
459 | -compdicend | |
460 | - | |
461 | -addstart | |
462 | -/regions=usgbnz | |
463 | -elequint/2 | |
464 | -elekwint/3 | |
465 | -addend | |
465 | +4dicend | |
466 | 466 | |
467 | -test1: | |
468 | -inputs wrong | |
469 | -comment wrong | |
470 | -puts OK | |
471 | -ok wrong | |
472 | -Ok wrong | |
473 | -the end. test wrong | |
474 | -déôl | |
475 | - | |
476 | -test2: | |
477 | -elequint test elekwint test elekwent asdf | |
478 | - | |
479 | -comptest: | |
480 | -word util | |
481 | -wordutil wordutils wordutilize | |
482 | -pro pro-ok | |
483 | -bork borkbork borkborkbork borkborkborkbork borkborkborkborkbork | |
484 | -borkborkborkborkborkbork | |
485 | -tomato tomatotomato tomatotomatotomato | |
486 | -startend endstart endend startstart wordend | |
487 | -startword startwordword wordstart startwordend startwordwordend | |
488 | -startwordwordwordend startwordwordwordwordend | |
489 | -prebork preborkprebork preborkborkprebork preborkpreborkbork | |
490 | -borkpreborkpreborkbork | |
467 | +4good: word util bork prebork start end wordutil wordutils pro-ok | |
468 | + bork borkbork borkborkbork borkborkborkbork borkborkborkborkbork | |
469 | + tomato tomatotomato startend startword startwordword startwordend | |
470 | + startwordwordend startwordwordwordend prebork preborkprebork | |
471 | + preborkborkprebork preborkpreborkbork | |
472 | +bad: wordutilize pro borkborkborkborkborkbork tomatotomatotomato | |
473 | + endstart endend startstart wordend wordstart | |
474 | + startwordwordwordwordend borkpreborkpreborkbork | |
475 | +badend | |
491 | 476 | |
492 | 477 | test output: |
@@ -1,16 +1,6 @@ | ||
1 | 1 | test output: |
2 | -inputs | |
3 | -['input', 'puts', 'outputs', 'put'] | |
4 | -comment | |
5 | -['Comment'] | |
6 | -ok | |
7 | -['OK', 'uk'] | |
8 | -Ok | |
9 | -['OK', 'Uk'] | |
10 | -test | |
11 | -['test', 'Test'] | |
12 | -déôl | |
13 | -['deol', 'déôr'] | |
2 | + | |
3 | +test 1-1 | |
14 | 4 | # file: Xtest.latin1.spl |
15 | 5 | Comment |
16 | 6 | deol |
@@ -28,6 +18,25 @@ | ||
28 | 18 | the end |
29 | 19 | uk |
30 | 20 | wrong |
21 | +------- | |
22 | +bad | |
23 | +['put', 'OK', 'uk'] | |
24 | +inputs | |
25 | +['input', 'puts', 'outputs'] | |
26 | +comment | |
27 | +['Comment'] | |
28 | +ok | |
29 | +['OK', 'uk', 'put'] | |
30 | +Ok | |
31 | +['OK', 'Uk', 'Put'] | |
32 | +test | |
33 | +['test', 'Test', 'testn'] | |
34 | +déôl | |
35 | +['deol', 'déôr', 'test'] | |
36 | +end | |
37 | +['put', 'test', 'uk'] | |
38 | +the | |
39 | +['put', 'uk', 'test'] | |
31 | 40 | gebletegek |
32 | 41 | kepereneven |
33 | 42 | everles gesvets etele |
@@ -43,6 +52,8 @@ | ||
43 | 52 | elekwent |
44 | 53 | elequint |
45 | 54 | elekwint |
55 | + | |
56 | +test 2-1 | |
46 | 57 | # file: Xtest.latin1.spl |
47 | 58 | Comment |
48 | 59 | deol |
@@ -60,18 +71,59 @@ | ||
60 | 71 | the end |
61 | 72 | uk |
62 | 73 | wrong |
74 | +------- | |
75 | +bad | |
76 | +['put', 'uk', 'OK'] | |
63 | 77 | inputs |
64 | -['input', 'puts', 'put', 'outputs'] | |
78 | +['input', 'puts', 'put'] | |
65 | 79 | comment |
66 | 80 | ['Comment'] |
67 | 81 | ok |
68 | -['OK', 'uk'] | |
82 | +['OK', 'uk', 'put'] | |
69 | 83 | Ok |
70 | -['OK', 'Uk'] | |
84 | +['OK', 'Uk', 'Put'] | |
85 | +end | |
86 | +['put', 'uk', 'deol'] | |
87 | +the | |
88 | +['put', 'uk', 'test'] | |
71 | 89 | test |
72 | -['test', 'Test'] | |
90 | +['test', 'Test', 'testn'] | |
73 | 91 | déôl |
74 | -['deol', 'déôr'] | |
92 | +['deol', 'déôr', 'test'] | |
93 | + | |
94 | +test 3-3 | |
95 | +# file: Xtest.latin1.spl | |
96 | +foo | |
97 | +mï | |
98 | +------- | |
99 | +bad | |
100 | +['foo', 'mï'] | |
101 | +bar | |
102 | +['foobar', 'foo', 'mï'] | |
103 | +la | |
104 | +['mï', 'foo'] | |
105 | +foomï | |
106 | +['foo mï', 'foo', 'foofoo'] | |
107 | +barmï | |
108 | +['bar mï', 'barfoo', 'barbar'] | |
109 | +mïfoo | |
110 | +['mï foo', 'foo', 'foofoo'] | |
111 | +mïbar | |
112 | +['foobar', 'barbar', 'mï'] | |
113 | +mïmï | |
114 | +['mï mï', 'mï', 'la mï'] | |
115 | +lala | |
116 | +['la mï'] | |
117 | +mïla | |
118 | +['mï', 'mï mï'] | |
119 | +lamï | |
120 | +['la mï', 'mï', 'mï mï'] | |
121 | +foola | |
122 | +['foo', 'foobar', 'foofoo'] | |
123 | +labar | |
124 | +['barbar', 'foobar'] | |
125 | + | |
126 | +test 4-4 | |
75 | 127 | # file: Xtest.latin1.spl |
76 | 128 | bork |
77 | 129 | prebork |
@@ -83,6 +135,9 @@ | ||
83 | 135 | utilize |
84 | 136 | utils |
85 | 137 | word |
138 | +------- | |
139 | +bad | |
140 | +['end', 'bork', 'word'] | |
86 | 141 | wordutilize |
87 | 142 | ['word utilize', 'wordutils', 'wordutil'] |
88 | 143 | pro |
@@ -8,65 +8,52 @@ | ||
8 | 8 | :" text is in latin1, the test text is utf-8. |
9 | 9 | :set enc=latin1 |
10 | 10 | :e! |
11 | +:set enc=utf-8 | |
11 | 12 | :set fenc= |
12 | -:" First generate a .spl file from a .dic and a .aff file. | |
13 | -gg:/^affstart1/+1,/^affend1/-1w! Xtest.aff | |
14 | -gg:/^dicstart/+1,/^dicend/-1w! Xtest.dic | |
15 | -:set enc=utf-8 | |
16 | -:mkspell! Xtest Xtest | |
17 | 13 | :" |
18 | -:" use that spell file | |
19 | -:set spl=Xtest.utf-8.spl | |
20 | -:set spell | |
21 | -:func SpellTest() | |
22 | -/^test1: | |
23 | -normal ]smm | |
24 | -let str = spellbadword() | |
25 | -$put =str | |
26 | -normal `m | |
27 | -let lst = spellsuggest(str, 4) | |
28 | -$put =string(lst) | |
29 | -normal `m]smm | |
30 | -let str = spellbadword() | |
31 | -$put =str | |
32 | -normal `m | |
33 | -let lst = spellsuggest(str, 2) | |
34 | -$put =string(lst) | |
35 | -normal `m]smm | |
36 | -let str = spellbadword() | |
37 | -$put =str | |
38 | -normal `m | |
39 | -let lst = spellsuggest(str, 2) | |
40 | -$put =string(lst) | |
41 | -normal `m]smm | |
42 | -let str = spellbadword() | |
43 | -$put =str | |
44 | -normal `m | |
45 | -let lst = spellsuggest(str, 2) | |
46 | -$put =string(lst) | |
47 | -normal `m]smm | |
48 | -let str = spellbadword() | |
49 | -$put =str | |
50 | -normal `m | |
51 | -let lst = spellsuggest(str, 2) | |
52 | -$put =string(lst) | |
53 | -normal `m]smm | |
54 | -let str = spellbadword() | |
55 | -$put =str | |
56 | -normal `m | |
57 | -let lst = spellsuggest(str, 2) | |
58 | -$put =string(lst) | |
14 | +:" Function to test .aff/.dic with list of good and bad words. | |
15 | +:func TestOne(aff, dic) | |
16 | + set spellfile= | |
17 | + $put ='' | |
18 | + $put ='test '. a:aff . '-' . a:dic | |
19 | + " Generate a .spl file from a .dic and .aff file. | |
20 | + exe '1;/^' . a:aff . 'affstart/+1,/^' . a:aff . 'affend/-1w! Xtest.aff' | |
21 | + exe '1;/^' . a:dic . 'dicstart/+1,/^' . a:dic . 'dicend/-1w! Xtest.dic' | |
22 | + mkspell! Xtest Xtest | |
23 | + " use that spell file | |
24 | + set spl=Xtest.utf-8.spl spell | |
25 | + " list all valid words | |
26 | + spelldump | |
27 | + %yank | |
28 | + quit | |
29 | + $put | |
30 | + $put ='-------' | |
31 | + " find all bad words and suggestions for them | |
32 | + exe '1;/^' . a:aff . 'good:' | |
33 | + normal 0f:]s | |
34 | + let prevbad = '' | |
35 | + while 1 | |
36 | + let bad = spellbadword() | |
37 | + if bad == '' || bad == prevbad || bad == 'badend' | |
38 | + break | |
39 | + endif | |
40 | + let prevbad = bad | |
41 | + let lst = spellsuggest(bad, 3) | |
42 | + normal mm | |
43 | + $put =bad | |
44 | + $put =string(lst) | |
45 | + normal `m]s | |
46 | + endwhile | |
59 | 47 | endfunc |
60 | -:call SpellTest() | |
61 | -:spelldump | |
62 | -1GyG:q | |
63 | -:$put | |
48 | +:" | |
49 | +:call TestOne('1', '1') | |
64 | 50 | :$put =soundfold('goobledygoook') |
65 | 51 | :$put =soundfold('kóopërÿnôven') |
66 | 52 | :$put =soundfold('oeverloos gezwets edale') |
67 | 53 | :" |
54 | +:" | |
68 | 55 | :" and now with SAL instead of SOFO items; test automatic reloading |
69 | -gg:/^affstart2/+1,/^affend2/-1w! Xtest.aff | |
56 | +gg:/^affstart_sal/+1,/^affend_sal/-1w! Xtest.aff | |
70 | 57 | :mkspell! Xtest Xtest |
71 | 58 | :$put =soundfold('goobledygoook') |
72 | 59 | :$put =soundfold('kóopërÿnôven') |
@@ -105,20 +92,16 @@ | ||
105 | 92 | :$put =str |
106 | 93 | :" |
107 | 94 | :" Postponed prefixes |
108 | -gg:/^affstart3/+1,/^affend3/-1w! Xtest.aff | |
109 | -:mkspell! Xtest Xtest | |
110 | -:set spellfile= | |
111 | -:set spl=Xtest.utf-8.spl | |
112 | -:mess | |
113 | -:spelldump | |
114 | -1GyG:q | |
115 | -:$put | |
116 | -:call SpellTest() | |
95 | +:call TestOne('2', '1') | |
96 | +:" | |
97 | +:" Compound words | |
98 | +:call TestOne('3', '3') | |
99 | +:call TestOne('4', '4') | |
117 | 100 | :" |
118 | 101 | gg:/^test output:/,$wq! test.out |
119 | 102 | ENDTEST |
120 | 103 | |
121 | -affstart1 | |
104 | +1affstart | |
122 | 105 | SET ISO8859-1 |
123 | 106 | TRY esianrtolcdugmphbyfvkwjkqxz-ëéèêïîäàâöüû'ESIANRTOLCDUGMPHBYFVKWJKQXZ |
124 | 107 |
@@ -167,9 +150,9 @@ | ||
167 | 150 | MAP cç |
168 | 151 | MAP yÿý |
169 | 152 | MAP sß |
170 | -affend1 | |
153 | +1affend | |
171 | 154 | |
172 | -affstart2 | |
155 | +affstart_sal | |
173 | 156 | SET ISO8859-1 |
174 | 157 | TRY esianrtolcdugmphbyfvkwjkqxz-ëéèêïîäàâöüû'ESIANRTOLCDUGMPHBYFVKWJKQXZ |
175 | 158 |
@@ -323,9 +306,9 @@ | ||
323 | 306 | SAL Y(AEIOU)- Y |
324 | 307 | SAL ZZ- _ |
325 | 308 | SAL Z S |
326 | -affend2 | |
309 | +affend_sal | |
327 | 310 | |
328 | -affstart3 | |
311 | +2affstart | |
329 | 312 | SET ISO8859-1 |
330 | 313 | |
331 | 314 | FOL àáâãäåæçèéêëìíîïðñòóôõöøùúûüýþßÿ |
@@ -372,9 +355,9 @@ | ||
372 | 355 | MAP cç |
373 | 356 | MAP yÿý |
374 | 357 | MAP sß |
375 | -affend3 | |
358 | +2affend | |
376 | 359 | |
377 | -dicstart | |
360 | +1dicstart | |
378 | 361 | 123456 |
379 | 362 | test/NO |
380 | 363 | # comment |
@@ -386,7 +369,7 @@ | ||
386 | 369 | the end |
387 | 370 | deol |
388 | 371 | déôr |
389 | -dicend | |
372 | +1dicend | |
390 | 373 | |
391 | 374 | addstart |
392 | 375 | /regions=usgbnz |
@@ -394,17 +377,105 @@ | ||
394 | 377 | elekwint/3 |
395 | 378 | addend |
396 | 379 | |
397 | -test1: | |
398 | -inputs wrong | |
399 | -comment wrong | |
400 | -puts OK | |
401 | -ok wrong | |
402 | -Ok wrong | |
403 | -the end. test wrong | |
404 | -déôl | |
380 | +1good: wrong OK puts. Test the end | |
381 | +bad: inputs comment ok Ok. test déôl end the | |
382 | +badend | |
383 | + | |
384 | +2good: puts | |
385 | +bad: inputs comment ok Ok end the. test déôl | |
386 | +badend | |
387 | + | |
388 | +Test rules for compounding. | |
389 | + | |
390 | +3affstart | |
391 | +SET ISO8859-1 | |
392 | + | |
393 | +COMPOUNDMIN 3 | |
394 | +COMPOUNDFLAGS m* | |
395 | +NEEDCOMPOUND x | |
396 | +3affend | |
397 | + | |
398 | +3dicstart | |
399 | +1234 | |
400 | +foo/m | |
401 | +bar/mx | |
402 | +mï/m | |
403 | +la/mx | |
404 | +3dicend | |
405 | + | |
406 | +3good: foo mï foobar foofoobar barfoo barbarfoo | |
407 | +bad: bar la foomï barmï mïfoo mïbar mïmï lala mïla lamï foola labar | |
408 | +badend | |
409 | + | |
410 | + | |
411 | +Tests for compounding. | |
412 | + | |
413 | +4affstart | |
414 | +SET ISO8859-1 | |
415 | + | |
416 | +FOL àáâãäåæçèéêëìíîïðñòóôõöøùúûüýþßÿ | |
417 | +LOW àáâãäåæçèéêëìíîïðñòóôõöøùúûüýþßÿ | |
418 | +UPP ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßÿ | |
419 | + | |
420 | +COMPOUNDFLAGS m+ | |
421 | +COMPOUNDFLAGS sm*e | |
422 | +COMPOUNDFLAGS sm+ | |
423 | +COMPOUNDMIN 3 | |
424 | +COMPOUNDMAX 3 | |
425 | + | |
426 | +COMPOUNDSYLMAX 5 | |
427 | +SYLLABLE aáeéiíoóöõuúüûy/aa/au/ea/ee/ei/ie/oa/oe/oo/ou/uu/ui | |
428 | + | |
429 | +MAP 9 | |
430 | +MAP aàáâãäå | |
431 | +MAP eèéêë | |
432 | +MAP iìíîï | |
433 | +MAP oòóôõö | |
434 | +MAP uùúûü | |
435 | +MAP nñ | |
436 | +MAP cç | |
437 | +MAP yÿý | |
438 | +MAP sß | |
439 | + | |
440 | +NEEDAFFIX x | |
441 | + | |
442 | +PFXPOSTPONE | |
443 | + | |
444 | +MIDWORD '- | |
445 | + | |
446 | +SFX q N 1 | |
447 | +SFX q 0 -ok . | |
448 | + | |
449 | +SFX a Y 2 | |
450 | +SFX a 0 s . | |
451 | +SFX a 0 ize . nocomp | |
452 | + | |
453 | +PFX p N 1 | |
454 | +PFX p 0 pre . | |
455 | +4affend | |
456 | + | |
457 | +4dicstart | |
458 | +1234 | |
459 | +word/m | |
460 | +util/am | |
461 | +pro/xq | |
462 | +tomato/m | |
463 | +bork/mp | |
464 | +start/s | |
465 | +end/e | |
466 | +4dicend | |
467 | + | |
468 | +4good: word util bork prebork start end wordutil wordutils pro-ok | |
469 | + bork borkbork borkborkbork borkborkborkbork borkborkborkborkbork | |
470 | + tomato tomatotomato startend startword startwordword startwordend | |
471 | + startwordwordend startwordwordwordend prebork preborkprebork | |
472 | + preborkborkprebork preborkpreborkbork | |
473 | +bad: wordutilize pro borkborkborkborkborkbork tomatotomatotomato | |
474 | + endstart endend startstart wordend wordstart | |
475 | + startwordwordwordwordend borkpreborkpreborkbork | |
476 | +badend | |
405 | 477 | |
406 | 478 | test2: |
407 | 479 | elequint test elekwint test elekwent asdf |
408 | 480 | |
409 | - | |
410 | 481 | test output: |
@@ -1,16 +1,6 @@ | ||
1 | 1 | test output: |
2 | -inputs | |
3 | -['input', 'puts', 'outputs', 'put'] | |
4 | -comment | |
5 | -['Comment'] | |
6 | -ok | |
7 | -['OK', 'uk'] | |
8 | -Ok | |
9 | -['OK', 'Uk'] | |
10 | -test | |
11 | -['test', 'Test'] | |
12 | -déôl | |
13 | -['deol', 'déôr'] | |
2 | + | |
3 | +test 1-1 | |
14 | 4 | # file: Xtest.utf-8.spl |
15 | 5 | Comment |
16 | 6 | deol |
@@ -28,6 +18,25 @@ | ||
28 | 18 | the end |
29 | 19 | uk |
30 | 20 | wrong |
21 | +------- | |
22 | +bad | |
23 | +['put', 'OK', 'uk'] | |
24 | +inputs | |
25 | +['input', 'puts', 'outputs'] | |
26 | +comment | |
27 | +['Comment'] | |
28 | +ok | |
29 | +['OK', 'uk', 'put'] | |
30 | +Ok | |
31 | +['OK', 'Uk', 'Put'] | |
32 | +test | |
33 | +['test', 'Test', 'testn'] | |
34 | +déôl | |
35 | +['deol', 'déôr', 'test'] | |
36 | +end | |
37 | +['put', 'test', 'uk'] | |
38 | +the | |
39 | +['put', 'uk', 'test'] | |
31 | 40 | gebletegek |
32 | 41 | kepereneven |
33 | 42 | everles gesvets etele |
@@ -43,6 +52,8 @@ | ||
43 | 52 | elekwent |
44 | 53 | elequint |
45 | 54 | elekwint |
55 | + | |
56 | +test 2-1 | |
46 | 57 | # file: Xtest.utf-8.spl |
47 | 58 | Comment |
48 | 59 | deol |
@@ -60,15 +71,92 @@ | ||
60 | 71 | the end |
61 | 72 | uk |
62 | 73 | wrong |
74 | +------- | |
75 | +bad | |
76 | +['put', 'uk', 'OK'] | |
63 | 77 | inputs |
64 | -['input', 'puts', 'put', 'outputs'] | |
78 | +['input', 'puts', 'put'] | |
65 | 79 | comment |
66 | 80 | ['Comment'] |
67 | 81 | ok |
68 | -['OK', 'uk'] | |
82 | +['OK', 'uk', 'put'] | |
69 | 83 | Ok |
70 | -['OK', 'Uk'] | |
84 | +['OK', 'Uk', 'Put'] | |
85 | +end | |
86 | +['put', 'uk', 'deol'] | |
87 | +the | |
88 | +['put', 'uk', 'test'] | |
71 | 89 | test |
72 | -['test', 'Test'] | |
90 | +['test', 'Test', 'testn'] | |
73 | 91 | déôl |
74 | -['deol', 'déôr'] | |
92 | +['deol', 'déôr', 'test'] | |
93 | + | |
94 | +test 3-3 | |
95 | +# file: Xtest.utf-8.spl | |
96 | +foo | |
97 | +mï | |
98 | +------- | |
99 | +bad | |
100 | +['foo', 'mï'] | |
101 | +bar | |
102 | +['foobar', 'foo', 'mï'] | |
103 | +la | |
104 | +['foo', 'mï'] | |
105 | +foomï | |
106 | +['foo mï', 'foo', 'foofoo'] | |
107 | +barmï | |
108 | +['bar mï', 'barfoo', 'barbar'] | |
109 | +mïfoo | |
110 | +['mï foo', 'foo', 'foofoo'] | |
111 | +mïbar | |
112 | +['foobar', 'barbar', 'mï'] | |
113 | +mïmï | |
114 | +['mï mï', 'mï', 'la mï'] | |
115 | +lala | |
116 | +[] | |
117 | +mïla | |
118 | +['mï'] | |
119 | +lamï | |
120 | +['la mï', 'mï', 'mï mï'] | |
121 | +foola | |
122 | +['foo', 'foobar', 'foofoo'] | |
123 | +labar | |
124 | +['barbar', 'foobar'] | |
125 | + | |
126 | +test 4-4 | |
127 | +# file: Xtest.utf-8.spl | |
128 | +bork | |
129 | +prebork | |
130 | +end | |
131 | +pro-ok | |
132 | +start | |
133 | +tomato | |
134 | +util | |
135 | +utilize | |
136 | +utils | |
137 | +word | |
138 | +------- | |
139 | +bad | |
140 | +['end', 'bork', 'word'] | |
141 | +wordutilize | |
142 | +['word utilize', 'wordutils', 'wordutil'] | |
143 | +pro | |
144 | +['bork', 'end', 'word'] | |
145 | +borkborkborkborkborkbork | |
146 | +['borkbork borkborkborkbork', 'borkborkbork borkborkbork', 'borkborkborkborkbork bork'] | |
147 | +tomatotomatotomato | |
148 | +['tomato tomatotomato', 'tomatotomato tomato', 'tomato tomato tomato'] | |
149 | +endstart | |
150 | +['end start', 'start'] | |
151 | +endend | |
152 | +['end end', 'end'] | |
153 | +startstart | |
154 | +['start start'] | |
155 | +wordend | |
156 | +['word end', 'wordword', 'word'] | |
157 | +wordstart | |
158 | +['word start', 'bork start'] | |
159 | +startwordwordwordwordend | |
160 | +['startwordwordwordword end', 'startwordwordwordword', 'start wordwordwordword end'] | |
161 | +borkpreborkpreborkbork | |
162 | +['borkpreborkprebork bork', 'borkprebork preborkbork', 'bork preborkpreborkbork'] |
@@ -36,5 +36,5 @@ | ||
36 | 36 | #define VIM_VERSION_NODOT "vim70aa" |
37 | 37 | #define VIM_VERSION_SHORT "7.0aa" |
38 | 38 | #define VIM_VERSION_MEDIUM "7.0aa ALPHA" |
39 | -#define VIM_VERSION_LONG "VIM - Vi IMproved 7.0aa ALPHA (2005 Aug 26)" | |
40 | -#define VIM_VERSION_LONG_DATE "VIM - Vi IMproved 7.0aa ALPHA (2005 Aug 26, compiled " | |
39 | +#define VIM_VERSION_LONG "VIM - Vi IMproved 7.0aa ALPHA (2005 Aug 29)" | |
40 | +#define VIM_VERSION_LONG_DATE "VIM - Vi IMproved 7.0aa ALPHA (2005 Aug 29, compiled " |