diff options
author | Bram Moolenaar <Bram@vim.org> | 2005-03-20 22:37:15 +0000 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2005-03-20 22:37:15 +0000 |
commit | 217ad920dd665ae74e055d870bfa05f73a20c2c8 (patch) | |
tree | c2fd40f30f58bee82ac2a42790c9042d4aabf505 /src | |
parent | 2e4096b0775518cabcd9e295cf1d96b211699135 (diff) | |
download | vim-git-217ad920dd665ae74e055d870bfa05f73a20c2c8.tar.gz |
updated for version 7.0062
Diffstat (limited to 'src')
-rw-r--r-- | src/Make_dice.mak | 4 | ||||
-rw-r--r-- | src/Make_mpw.mak | 131 | ||||
-rw-r--r-- | src/Make_os2.mak | 2 | ||||
-rw-r--r-- | src/Make_sas.mak | 5 | ||||
-rw-r--r-- | src/Make_vms.mms | 10 | ||||
-rw-r--r-- | src/Makefile | 44 | ||||
-rw-r--r-- | src/charset.c | 4 | ||||
-rw-r--r-- | src/edit.c | 32 | ||||
-rw-r--r-- | src/globals.h | 4 | ||||
-rw-r--r-- | src/mbyte.c | 13 | ||||
-rw-r--r-- | src/option.c | 45 | ||||
-rw-r--r-- | src/proto/syntax.pro | 3 | ||||
-rw-r--r-- | src/screen.c | 68 | ||||
-rw-r--r-- | src/structs.h | 10 | ||||
-rw-r--r-- | src/syntax.c | 197 | ||||
-rw-r--r-- | src/version.h | 4 |
16 files changed, 542 insertions, 34 deletions
diff --git a/src/Make_dice.mak b/src/Make_dice.mak index f2b090749..c5fea5ee3 100644 --- a/src/Make_dice.mak +++ b/src/Make_dice.mak @@ -59,6 +59,7 @@ SRC = \ regexp.c \ screen.c \ search.c \ + spell.c \ syntax.c \ tag.c \ term.c \ @@ -100,6 +101,7 @@ OBJ = o/buffer.o \ o/regexp.o \ o/screen.o \ o/search.o \ + o/spell.o \ o/syntax.o \ o/tag.o \ o/term.o \ @@ -198,6 +200,8 @@ o/screen.o: screen.c $(SYMS) o/search.o: search.c $(SYMS) regexp.h +o/spell.o: spell.c $(SYMS) + o/syntax.o: syntax.c $(SYMS) o/tag.o: tag.c $(SYMS) diff --git a/src/Make_mpw.mak b/src/Make_mpw.mak index cd366e47f..4ee0e52ac 100644 --- a/src/Make_mpw.mak +++ b/src/Make_mpw.mak @@ -55,6 +55,7 @@ SrcFiles = ¶ :src:regexp.c ¶ :src:screen.c ¶ :src:search.c ¶ + :src:spell.c ¶ :src:syntax.c ¶ :src:tag.c ¶ :src:term.c ¶ @@ -106,6 +107,7 @@ ObjFiles-PPC = ¶ "{ObjDir}regexp.c.x" ¶ "{ObjDir}screen.c.x" ¶ "{ObjDir}search.c.x" ¶ + "{ObjDir}spell.c.x" ¶ "{ObjDir}syntax.c.x" ¶ "{ObjDir}tag.c.x" ¶ "{ObjDir}term.c.x" ¶ @@ -188,6 +190,7 @@ VIm ÄÄ {ObjFiles-PPC} {LibFiles-PPC} {¥MondoBuild¥} "{ObjDir}regexp.c.x" Ä :src:regexp.c "{ObjDir}screen.c.x" Ä :src:screen.c "{ObjDir}search.c.x" Ä :src:search.c +"{ObjDir}spell.c.x" Ä :src:spell.c "{ObjDir}syntax.c.x" Ä :src:syntax.c "{ObjDir}tag.c.x" Ä :src:tag.c "{ObjDir}term.c.x" Ä :src:term.c @@ -273,6 +276,7 @@ Dependencies Ä $OutOfDate :src:proto:regexp.pro ¶ :src:proto:screen.pro ¶ :src:proto:search.pro ¶ + :src:proto:spell.pro ¶ :src:proto:syntax.pro ¶ :src:proto:tag.pro ¶ :src:proto:term.pro ¶ @@ -354,6 +358,7 @@ Dependencies Ä $OutOfDate :src:proto:regexp.pro ¶ :src:proto:screen.pro ¶ :src:proto:search.pro ¶ + :src:proto:spell.pro ¶ :src:proto:syntax.pro ¶ :src:proto:tag.pro ¶ :src:proto:term.pro ¶ @@ -435,6 +440,7 @@ Dependencies Ä $OutOfDate :src:proto:regexp.pro ¶ :src:proto:screen.pro ¶ :src:proto:search.pro ¶ + :src:proto:spell.pro ¶ :src:proto:syntax.pro ¶ :src:proto:tag.pro ¶ :src:proto:term.pro ¶ @@ -516,6 +522,7 @@ Dependencies Ä $OutOfDate :src:proto:regexp.pro ¶ :src:proto:screen.pro ¶ :src:proto:search.pro ¶ + :src:proto:spell.pro ¶ :src:proto:syntax.pro ¶ :src:proto:tag.pro ¶ :src:proto:term.pro ¶ @@ -597,6 +604,7 @@ Dependencies Ä $OutOfDate :src:proto:regexp.pro ¶ :src:proto:screen.pro ¶ :src:proto:search.pro ¶ + :src:proto:spell.pro ¶ :src:proto:syntax.pro ¶ :src:proto:tag.pro ¶ :src:proto:term.pro ¶ @@ -679,6 +687,7 @@ Dependencies Ä $OutOfDate :src:proto:regexp.pro ¶ :src:proto:screen.pro ¶ :src:proto:search.pro ¶ + :src:proto:spell.pro ¶ :src:proto:syntax.pro ¶ :src:proto:tag.pro ¶ :src:proto:term.pro ¶ @@ -760,6 +769,7 @@ Dependencies Ä $OutOfDate :src:proto:regexp.pro ¶ :src:proto:screen.pro ¶ :src:proto:search.pro ¶ + :src:proto:spell.pro ¶ :src:proto:syntax.pro ¶ :src:proto:tag.pro ¶ :src:proto:term.pro ¶ @@ -841,6 +851,7 @@ Dependencies Ä $OutOfDate :src:proto:regexp.pro ¶ :src:proto:screen.pro ¶ :src:proto:search.pro ¶ + :src:proto:spell.pro ¶ :src:proto:syntax.pro ¶ :src:proto:tag.pro ¶ :src:proto:term.pro ¶ @@ -922,6 +933,7 @@ Dependencies Ä $OutOfDate :src:proto:regexp.pro ¶ :src:proto:screen.pro ¶ :src:proto:search.pro ¶ + :src:proto:spell.pro ¶ :src:proto:syntax.pro ¶ :src:proto:tag.pro ¶ :src:proto:term.pro ¶ @@ -1003,6 +1015,7 @@ Dependencies Ä $OutOfDate :src:proto:regexp.pro ¶ :src:proto:screen.pro ¶ :src:proto:search.pro ¶ + :src:proto:spell.pro ¶ :src:proto:syntax.pro ¶ :src:proto:tag.pro ¶ :src:proto:term.pro ¶ @@ -1084,6 +1097,7 @@ Dependencies Ä $OutOfDate :src:proto:regexp.pro ¶ :src:proto:screen.pro ¶ :src:proto:search.pro ¶ + :src:proto:spell.pro ¶ :src:proto:syntax.pro ¶ :src:proto:tag.pro ¶ :src:proto:term.pro ¶ @@ -1165,6 +1179,7 @@ Dependencies Ä $OutOfDate :src:proto:regexp.pro ¶ :src:proto:screen.pro ¶ :src:proto:search.pro ¶ + :src:proto:spell.pro ¶ :src:proto:syntax.pro ¶ :src:proto:tag.pro ¶ :src:proto:term.pro ¶ @@ -1246,6 +1261,7 @@ Dependencies Ä $OutOfDate :src:proto:regexp.pro ¶ :src:proto:screen.pro ¶ :src:proto:search.pro ¶ + :src:proto:spell.pro ¶ :src:proto:syntax.pro ¶ :src:proto:tag.pro ¶ :src:proto:term.pro ¶ @@ -1326,6 +1342,7 @@ Dependencies Ä $OutOfDate :src:proto:regexp.pro ¶ :src:proto:screen.pro ¶ :src:proto:search.pro ¶ + :src:proto:spell.pro ¶ :src:proto:syntax.pro ¶ :src:proto:tag.pro ¶ :src:proto:term.pro ¶ @@ -1407,6 +1424,7 @@ Dependencies Ä $OutOfDate :src:proto:regexp.pro ¶ :src:proto:screen.pro ¶ :src:proto:search.pro ¶ + :src:proto:spell.pro ¶ :src:proto:syntax.pro ¶ :src:proto:tag.pro ¶ :src:proto:term.pro ¶ @@ -1488,6 +1506,7 @@ Dependencies Ä $OutOfDate :src:proto:regexp.pro ¶ :src:proto:screen.pro ¶ :src:proto:search.pro ¶ + :src:proto:spell.pro ¶ :src:proto:syntax.pro ¶ :src:proto:tag.pro ¶ :src:proto:term.pro ¶ @@ -1569,6 +1588,7 @@ Dependencies Ä $OutOfDate :src:proto:regexp.pro ¶ :src:proto:screen.pro ¶ :src:proto:search.pro ¶ + :src:proto:spell.pro ¶ :src:proto:syntax.pro ¶ :src:proto:tag.pro ¶ :src:proto:term.pro ¶ @@ -1676,6 +1696,7 @@ Dependencies Ä $OutOfDate :src:proto:regexp.pro ¶ :src:proto:screen.pro ¶ :src:proto:search.pro ¶ + :src:proto:spell.pro ¶ :src:proto:syntax.pro ¶ :src:proto:tag.pro ¶ :src:proto:term.pro ¶ @@ -1758,6 +1779,7 @@ Dependencies Ä $OutOfDate :src:proto:regexp.pro ¶ :src:proto:screen.pro ¶ :src:proto:search.pro ¶ + :src:proto:spell.pro ¶ :src:proto:syntax.pro ¶ :src:proto:tag.pro ¶ :src:proto:term.pro ¶ @@ -1839,6 +1861,7 @@ Dependencies Ä $OutOfDate :src:proto:regexp.pro ¶ :src:proto:screen.pro ¶ :src:proto:search.pro ¶ + :src:proto:spell.pro ¶ :src:proto:syntax.pro ¶ :src:proto:tag.pro ¶ :src:proto:term.pro ¶ @@ -1920,6 +1943,7 @@ Dependencies Ä $OutOfDate :src:proto:regexp.pro ¶ :src:proto:screen.pro ¶ :src:proto:search.pro ¶ + :src:proto:spell.pro ¶ :src:proto:syntax.pro ¶ :src:proto:tag.pro ¶ :src:proto:term.pro ¶ @@ -2001,6 +2025,7 @@ Dependencies Ä $OutOfDate :src:proto:regexp.pro ¶ :src:proto:screen.pro ¶ :src:proto:search.pro ¶ + :src:proto:spell.pro ¶ :src:proto:syntax.pro ¶ :src:proto:tag.pro ¶ :src:proto:term.pro ¶ @@ -2082,6 +2107,7 @@ Dependencies Ä $OutOfDate :src:proto:regexp.pro ¶ :src:proto:screen.pro ¶ :src:proto:search.pro ¶ + :src:proto:spell.pro ¶ :src:proto:syntax.pro ¶ :src:proto:tag.pro ¶ :src:proto:term.pro ¶ @@ -2163,6 +2189,7 @@ Dependencies Ä $OutOfDate :src:proto:regexp.pro ¶ :src:proto:screen.pro ¶ :src:proto:search.pro ¶ + :src:proto:spell.pro ¶ :src:proto:syntax.pro ¶ :src:proto:tag.pro ¶ :src:proto:term.pro ¶ @@ -2245,6 +2272,7 @@ Dependencies Ä $OutOfDate :src:proto:regexp.pro ¶ :src:proto:screen.pro ¶ :src:proto:search.pro ¶ + :src:proto:spell.pro ¶ :src:proto:syntax.pro ¶ :src:proto:tag.pro ¶ :src:proto:term.pro ¶ @@ -2326,6 +2354,7 @@ Dependencies Ä $OutOfDate :src:proto:regexp.pro ¶ :src:proto:screen.pro ¶ :src:proto:search.pro ¶ + :src:proto:spell.pro ¶ :src:proto:syntax.pro ¶ :src:proto:tag.pro ¶ :src:proto:term.pro ¶ @@ -2407,6 +2436,7 @@ Dependencies Ä $OutOfDate :src:proto:regexp.pro ¶ :src:proto:screen.pro ¶ :src:proto:search.pro ¶ + :src:proto:spell.pro ¶ :src:proto:syntax.pro ¶ :src:proto:tag.pro ¶ :src:proto:term.pro ¶ @@ -2488,6 +2518,7 @@ Dependencies Ä $OutOfDate :src:proto:regexp.pro ¶ :src:proto:screen.pro ¶ :src:proto:search.pro ¶ + :src:proto:spell.pro ¶ :src:proto:syntax.pro ¶ :src:proto:tag.pro ¶ :src:proto:term.pro ¶ @@ -2569,6 +2600,7 @@ Dependencies Ä $OutOfDate :src:proto:regexp.pro ¶ :src:proto:screen.pro ¶ :src:proto:search.pro ¶ + :src:proto:spell.pro ¶ :src:proto:syntax.pro ¶ :src:proto:tag.pro ¶ :src:proto:term.pro ¶ @@ -2650,6 +2682,7 @@ Dependencies Ä $OutOfDate :src:proto:regexp.pro ¶ :src:proto:screen.pro ¶ :src:proto:search.pro ¶ + :src:proto:spell.pro ¶ :src:proto:syntax.pro ¶ :src:proto:tag.pro ¶ :src:proto:term.pro ¶ @@ -2731,6 +2764,7 @@ Dependencies Ä $OutOfDate :src:proto:regexp.pro ¶ :src:proto:screen.pro ¶ :src:proto:search.pro ¶ + :src:proto:spell.pro ¶ :src:proto:syntax.pro ¶ :src:proto:tag.pro ¶ :src:proto:term.pro ¶ @@ -2812,6 +2846,7 @@ Dependencies Ä $OutOfDate :src:proto:regexp.pro ¶ :src:proto:screen.pro ¶ :src:proto:search.pro ¶ + :src:proto:spell.pro ¶ :src:proto:syntax.pro ¶ :src:proto:tag.pro ¶ :src:proto:term.pro ¶ @@ -2893,6 +2928,7 @@ Dependencies Ä $OutOfDate :src:proto:regexp.pro ¶ :src:proto:screen.pro ¶ :src:proto:search.pro ¶ + :src:proto:spell.pro ¶ :src:proto:syntax.pro ¶ :src:proto:tag.pro ¶ :src:proto:term.pro ¶ @@ -2974,6 +3010,7 @@ Dependencies Ä $OutOfDate :src:proto:regexp.pro ¶ :src:proto:screen.pro ¶ :src:proto:search.pro ¶ + :src:proto:spell.pro ¶ :src:proto:syntax.pro ¶ :src:proto:tag.pro ¶ :src:proto:term.pro ¶ @@ -3055,6 +3092,7 @@ Dependencies Ä $OutOfDate :src:proto:regexp.pro ¶ :src:proto:screen.pro ¶ :src:proto:search.pro ¶ + :src:proto:spell.pro ¶ :src:proto:syntax.pro ¶ :src:proto:tag.pro ¶ :src:proto:term.pro ¶ @@ -3136,6 +3174,7 @@ Dependencies Ä $OutOfDate :src:proto:regexp.pro ¶ :src:proto:screen.pro ¶ :src:proto:search.pro ¶ + :src:proto:spell.pro ¶ :src:proto:syntax.pro ¶ :src:proto:tag.pro ¶ :src:proto:term.pro ¶ @@ -3217,6 +3256,89 @@ Dependencies Ä $OutOfDate :src:proto:regexp.pro ¶ :src:proto:screen.pro ¶ :src:proto:search.pro ¶ + :src:proto:spell.pro ¶ + :src:proto:syntax.pro ¶ + :src:proto:tag.pro ¶ + :src:proto:term.pro ¶ + :src:proto:termlib.pro ¶ + :src:proto:ui.pro ¶ + :src:proto:undo.pro ¶ + :src:proto:version.pro ¶ + :src:proto:window.pro ¶ + :src:proto:if_python.pro ¶ + :src:proto:if_tcl.pro ¶ + :src:proto:if_ruby.pro ¶ + :src:proto:gui.pro ¶ + :src:proto:pty.pro ¶ + :src:proto:gui_gtk.pro ¶ + :src:proto:gui_gtk_x11.pro ¶ + :src:proto:gui_motif.pro ¶ + :src:proto:gui_athena.pro ¶ + :src:proto:gui_mac.pro ¶ + :src:proto:gui_x11.pro ¶ + :src:proto:workshop.pro ¶ + :src:proto:if_perl.pro ¶ + :src:proto:if_perlsfio.pro + +:obj:spell.c.x Ä ¶ + :src:spell.c ¶ + :src:vim.h ¶ + :src:auto:config.h ¶ + :src:feature.h ¶ + :src:os_unix.h ¶ + :src:os_mac.h ¶ + :src:workshop.h ¶ + :src:ascii.h ¶ + :src:keymap.h ¶ + :src:term.h ¶ + :src:macros.h ¶ + :src:structs.h ¶ + :src:globals.h ¶ + :src:option.h ¶ + :src:ex_cmds.h ¶ + :src:proto.h ¶ + :src:integration.h ¶ + :src:wsdebug.h ¶ + :src:regexp.h ¶ + :src:gui.h ¶ + :src:farsi.h ¶ + :src:proto:os_unix.pro ¶ + :src:proto:os_mac.pro ¶ + :src:proto:buffer.pro ¶ + :src:proto:charset.pro ¶ + :src:proto:if_cscope.pro ¶ + :src:proto:diff.pro ¶ + :src:proto:digraph.pro ¶ + :src:proto:edit.pro ¶ + :src:proto:eval.pro ¶ + :src:proto:ex_cmds.pro ¶ + :src:proto:ex_cmds2.pro ¶ + :src:proto:ex_docmd.pro ¶ + :src:proto:ex_eval.pro ¶ + :src:proto:ex_getln.pro ¶ + :src:proto:fileio.pro ¶ + :src:proto:fold.pro ¶ + :src:proto:getchar.pro ¶ + :src:proto:hashtable.pro ¶ + :src:proto:hangulin.pro ¶ + :src:proto:main.pro ¶ + :src:proto:mark.pro ¶ + :src:proto:memfile.pro ¶ + :src:proto:memline.pro ¶ + :src:proto:menu.pro ¶ + :src:proto:message.pro ¶ + :src:proto:misc1.pro ¶ + :src:proto:misc2.pro ¶ + :src:proto:move.pro ¶ + :src:proto:multibyte.pro ¶ + :src:proto:normal.pro ¶ + :src:proto:ops.pro ¶ + :src:proto:option.pro ¶ + :src:proto:quickfix.pro ¶ + :src:proto:regexp.pro ¶ + :src:proto:screen.pro ¶ + :src:proto:search.pro ¶ + :src:proto:spell.pro ¶ :src:proto:syntax.pro ¶ :src:proto:tag.pro ¶ :src:proto:term.pro ¶ @@ -3298,6 +3420,7 @@ Dependencies Ä $OutOfDate :src:proto:regexp.pro ¶ :src:proto:screen.pro ¶ :src:proto:search.pro ¶ + :src:proto:spell.pro ¶ :src:proto:syntax.pro ¶ :src:proto:tag.pro ¶ :src:proto:term.pro ¶ @@ -3379,6 +3502,7 @@ Dependencies Ä $OutOfDate :src:proto:regexp.pro ¶ :src:proto:screen.pro ¶ :src:proto:search.pro ¶ + :src:proto:spell.pro ¶ :src:proto:syntax.pro ¶ :src:proto:tag.pro ¶ :src:proto:term.pro ¶ @@ -3460,6 +3584,7 @@ Dependencies Ä $OutOfDate :src:proto:regexp.pro ¶ :src:proto:screen.pro ¶ :src:proto:search.pro ¶ + :src:proto:spell.pro ¶ :src:proto:syntax.pro ¶ :src:proto:tag.pro ¶ :src:proto:term.pro ¶ @@ -3542,6 +3667,7 @@ Dependencies Ä $OutOfDate :src:proto:regexp.pro ¶ :src:proto:screen.pro ¶ :src:proto:search.pro ¶ + :src:proto:spell.pro ¶ :src:proto:syntax.pro ¶ :src:proto:tag.pro ¶ :src:proto:term.pro ¶ @@ -3622,6 +3748,7 @@ Dependencies Ä $OutOfDate :src:proto:regexp.pro ¶ :src:proto:screen.pro ¶ :src:proto:search.pro ¶ + :src:proto:spell.pro ¶ :src:proto:syntax.pro ¶ :src:proto:tag.pro ¶ :src:proto:term.pro ¶ @@ -3703,6 +3830,7 @@ Dependencies Ä $OutOfDate :src:proto:regexp.pro ¶ :src:proto:screen.pro ¶ :src:proto:search.pro ¶ + :src:proto:spell.pro ¶ :src:proto:syntax.pro ¶ :src:proto:tag.pro ¶ :src:proto:term.pro ¶ @@ -3785,6 +3913,7 @@ Dependencies Ä $OutOfDate :src:proto:regexp.pro ¶ :src:proto:screen.pro ¶ :src:proto:search.pro ¶ + :src:proto:spell.pro ¶ :src:proto:syntax.pro ¶ :src:proto:tag.pro ¶ :src:proto:term.pro ¶ @@ -3866,6 +3995,7 @@ Dependencies Ä $OutOfDate :src:proto:regexp.pro ¶ :src:proto:screen.pro ¶ :src:proto:search.pro ¶ + :src:proto:spell.pro ¶ :src:proto:syntax.pro ¶ :src:proto:tag.pro ¶ :src:proto:term.pro ¶ @@ -3947,6 +4077,7 @@ Dependencies Ä $OutOfDate :src:proto:regexp.pro ¶ :src:proto:screen.pro ¶ :src:proto:search.pro ¶ + :src:proto:spell.pro ¶ :src:proto:syntax.pro ¶ :src:proto:tag.pro ¶ :src:proto:term.pro ¶ diff --git a/src/Make_os2.mak b/src/Make_os2.mak index 1750e71f2..c18538ef8 100644 --- a/src/Make_os2.mak +++ b/src/Make_os2.mak @@ -71,6 +71,7 @@ OBJ = \ regexp.o \ screen.o \ search.o \ + spell.o \ syntax.o \ tag.o \ term.o \ @@ -141,6 +142,7 @@ quickfix.o: quickfix.c $(INCL) regexp.o: regexp.c $(INCL) screen.o: screen.c $(INCL) search.o: search.c $(INCL) +spell.o: spell.c $(INCL) syntax.o: syntax.c $(INCL) tag.o: tag.c $(INCL) term.o: term.c $(INCL) diff --git a/src/Make_sas.mak b/src/Make_sas.mak index 1751d8ae8..3e563f9a5 100644 --- a/src/Make_sas.mak +++ b/src/Make_sas.mak @@ -122,6 +122,7 @@ SRC = \ regexp.c \ screen.c \ search.c \ + spell.c \ syntax.c \ tag.c \ term.c \ @@ -164,6 +165,7 @@ OBJ = \ regexp.o \ screen.o \ search.o \ + spell.o \ syntax.o \ tag.o \ term.o \ @@ -206,6 +208,7 @@ PRO = \ proto/regexp.pro \ proto/screen.pro \ proto/search.pro \ + proto/spell.pro \ proto/syntax.pro \ proto/tag.pro \ proto/term.pro \ @@ -335,6 +338,8 @@ screen.o: screen.c proto/screen.pro: screen.c search.o: search.c proto/search.pro: search.c +spell.o: spell.c +proto/spell.pro: spell.c syntax.o: syntax.c proto/syntax.pro: syntax.c tag.o: tag.c diff --git a/src/Make_vms.mms b/src/Make_vms.mms index b44855247..ca582ffcf 100644 --- a/src/Make_vms.mms +++ b/src/Make_vms.mms @@ -2,7 +2,7 @@ # Makefile for Vim on OpenVMS # # Maintainer: Zoltan Arpadffy <arpadffy@polarhome.com> -# Last change: 2005 Jan 19 +# Last change: 2005 Mar 19 # # This has script been tested on VMS 6.2 to 7.3 on DEC Alpha, VAX and IA64 # with MMS and MMK @@ -276,7 +276,7 @@ SRC = buffer.c charset.c diff.c digraph.c edit.c eval.c ex_cmds.c ex_cmds2.c \ ex_docmd.c ex_eval.c ex_getln.c if_xcmdsrv.c fileio.c fold.c getchar.c \ hashtable.c, main.c mark.c menu.c mbyte.c memfile.c memline.c message.c misc1.c \ misc2.c move.c normal.c ops.c option.c quickfix.c regexp.c search.c \ - syntax.c tag.c term.c termlib.c ui.c undo.c version.c screen.c \ + spell.c syntax.c tag.c term.c termlib.c ui.c undo.c version.c screen.c \ window.c os_unix.c os_vms.c pathdef.c \ $(GUI_SRC) $(PERL_SRC) $(PYTHON_SRC) $(TCL_SRC) $(SNIFF_SRC) \ $(RUBY_SRC) $(HANGULIN_SRC) @@ -286,7 +286,7 @@ OBJ = buffer.obj charset.obj diff.obj digraph.obj edit.obj eval.obj \ if_xcmdsrv.obj fileio.obj fold.obj getchar.obj hashtable.obj main.obj mark.obj \ menu.obj memfile.obj memline.obj message.obj misc1.obj misc2.obj \ move.obj mbyte.obj normal.obj ops.obj option.obj quickfix.obj \ - regexp.obj search.obj syntax.obj tag.obj term.obj termlib.obj \ + regexp.obj search.obj spell.obj syntax.obj tag.obj term.obj termlib.obj \ ui.obj undo.obj screen.obj version.obj window.obj os_unix.obj \ os_vms.obj pathdef.obj \ $(GUI_OBJ) $(PERL_OBJ) $(PYTHON_OBJ) $(TCL_OBJ) $(SNIFF_OBJ) \ @@ -602,6 +602,10 @@ search.obj : search.c vim.h [.auto]config.h feature.h os_unix.h \ ascii.h keymap.h term.h macros.h structs.h regexp.h \ gui.h gui_beval.h [.proto]gui_beval.pro option.h ex_cmds.h proto.h \ globals.h farsi.h arabic.h +spell.obj : spell.c vim.h [.auto]config.h feature.h os_unix.h \ + ascii.h keymap.h term.h macros.h structs.h regexp.h \ + gui.h gui_beval.h [.proto]gui_beval.pro option.h ex_cmds.h proto.h \ + globals.h farsi.h arabic.h syntax.obj : syntax.c vim.h [.auto]config.h feature.h os_unix.h \ ascii.h keymap.h term.h macros.h structs.h regexp.h \ gui.h gui_beval.h [.proto]gui_beval.pro option.h ex_cmds.h proto.h \ diff --git a/src/Makefile b/src/Makefile index a15398a18..a70d10f6b 100644 --- a/src/Makefile +++ b/src/Makefile @@ -125,6 +125,7 @@ # make installmanlinks only installs the Vim manpage links # make installmacros only installs the Vim macros # make installtutor only installs the Vim tutor +# make installspell only installs the spell files # make installtools only installs xxd # If you install Vim, not to install for real but to prepare a package # or RPM, set DESTDIR to the root of the tree. @@ -874,6 +875,7 @@ KMAPSUBDIR = /keymap MACROSUBDIR = /macros TOOLSSUBDIR = /tools TUTORSUBDIR = /tutor +SPELLSUBDIR = /spell PRINTSUBDIR = /print PODIR = po @@ -893,6 +895,7 @@ PODIR = po ### MACROSUBLOC location for macro files ### TOOLSSUBLOC location for tools files ### TUTORSUBLOC location for tutor files +### SPELLSUBLOC location for spell files ### PRINTSUBLOC location for PostScript files (prolog, latin1, ..) ### SCRIPTLOC location for script files (menu.vim, bugreport.vim, ..) ### You can override these if you want to install them somewhere else. @@ -912,6 +915,7 @@ KMAPSUBLOC = $(VIMRTLOC)$(KMAPSUBDIR) MACROSUBLOC = $(VIMRTLOC)$(MACROSUBDIR) TOOLSSUBLOC = $(VIMRTLOC)$(TOOLSSUBDIR) TUTORSUBLOC = $(VIMRTLOC)$(TUTORSUBDIR) +SPELLSUBLOC = $(VIMRTLOC)$(SPELLSUBDIR) PRINTSUBLOC = $(VIMRTLOC)$(PRINTSUBDIR) SCRIPTLOC = $(VIMRTLOC) @@ -1016,6 +1020,9 @@ TOOLSSOURCE = ../runtime/tools # Where to copy the tutor files from TUTORSOURCE = ../runtime/tutor +# Where to copy the spell files from +SPELLSOURCE = ../runtime/spell + # Where to look for language specific files LANGSOURCE = ../runtime/lang @@ -1275,6 +1282,7 @@ DEST_KMAP = $(DESTDIR)$(KMAPSUBLOC) DEST_MACRO = $(DESTDIR)$(MACROSUBLOC) DEST_TOOLS = $(DESTDIR)$(TOOLSSUBLOC) DEST_TUTOR = $(DESTDIR)$(TUTORSUBLOC) +DEST_SPELL = $(DESTDIR)$(SPELLSUBLOC) DEST_SCRIPT = $(DESTDIR)$(SCRIPTLOC) DEST_PRINT = $(DESTDIR)$(PRINTSUBLOC) DEST_MAN_TOP = $(DESTDIR)$(MANDIR) @@ -1282,8 +1290,10 @@ DEST_MAN_TOP = $(DESTDIR)$(MANDIR) # We assume that the ".../man/xx/man1/" directory is for latin1 manual pages. # Some systems use UTF-8, but these should find the ".../man/xx.UTF-8/man1/" # directory first. +# FreeBSD uses ".../man/xx.ISO8859-1/man1" for latin1, use that one too. DEST_MAN = $(DEST_MAN_TOP)$(MAN1DIR) DEST_MAN_IT = $(DEST_MAN_TOP)/it$(MAN1DIR) +DEST_MAN_IT_I = $(DEST_MAN_TOP)/it.ISO8859-1$(MAN1DIR) DEST_MAN_IT_U = $(DEST_MAN_TOP)/it.UTF-8$(MAN1DIR) DEST_MAN_RU = $(DEST_MAN_TOP)/ru.KOI8-R$(MAN1DIR) DEST_MAN_RU_U = $(DEST_MAN_TOP)/ru.UTF-8$(MAN1DIR) @@ -1336,6 +1346,7 @@ BASIC_SRC = \ regexp.c \ screen.c \ search.c \ + spell.c \ syntax.c \ tag.c \ term.c \ @@ -1404,6 +1415,7 @@ OBJ = \ objects/regexp.o \ objects/screen.o \ objects/search.o \ + objects/spell.o \ objects/syntax.o \ $(SNIFF_OBJ) \ objects/tag.o \ @@ -1461,6 +1473,7 @@ PRO_AUTO = \ regexp.pro \ screen.pro \ search.pro \ + spell.pro \ syntax.pro \ tag.pro \ term.pro \ @@ -1681,7 +1694,7 @@ install: $(GUI_INSTALL) install_normal: installvim installtools install-languages install-icons -installvim: installvimbin installruntime installlinks installmanlinks installmacros installtutor +installvim: installvimbin installruntime installlinks installmanlinks installmacros installtutor installspell installvimbin: $(VIMTARGET) $(DESTDIR)$(exec_prefix) $(DEST_BIN) -if test -f $(DEST_BIN)/$(VIMTARGET); then \ @@ -1702,7 +1715,7 @@ INSTALLMANARGS = $(VIMLOC) $(SCRIPTLOC) $(VIMRCLOC) $(HELPSOURCE) $(MANMOD) \ # install the help files; first adjust the contents for the final location installruntime: $(HELPSOURCE)/vim.1 $(DEST_VIM) $(DEST_RT) \ $(DEST_HELP) $(DEST_PRINT) $(DEST_COL) $(DEST_SYN) $(DEST_IND) \ - $(DEST_FTP) $(DEST_PLUG) $(DEST_TUTOR) $(DEST_COMP) + $(DEST_FTP) $(DEST_PLUG) $(DEST_TUTOR) $(DEST_SPELL) $(DEST_COMP) -$(SHELL) ./installman.sh install $(DEST_MAN) "" $(INSTALLMANARGS) @echo generating help tags # Generate the help tags with ":helptags" to handle all languages. @@ -1792,6 +1805,13 @@ installtutor: $(TUTORSOURCE) $(DEST_VIM) $(DEST_RT) $(DEST_TUTOR) -$(INSTALL_DATA) $(TUTORSOURCE)/README* $(TUTORSOURCE)/tutor* $(DEST_TUTOR) chmod $(HELPMOD) $(DEST_TUTOR)/* +# Install the spell files, if they exist. +installspell: $(SPELLSOURCE) $(DEST_VIM) $(DEST_RT) $(DEST_SPELL) + if test -f $(SPELLSOURCE)/en.spl; then \ + $(INSTALL_DATA) $(SPELLSOURCE)/*.spl $(DEST_SPELL); \ + chmod $(HELPMOD) $(DEST_SPELL)/*.spl; \ + fi + # install helper program xxd installtools: $(TOOLS) $(DESTDIR)$(exec_prefix) $(DEST_BIN) \ $(TOOLSSOURCE) $(DEST_VIM) $(DEST_RT) $(DEST_TOOLS) @@ -1804,6 +1824,7 @@ installtools: $(TOOLS) $(DESTDIR)$(exec_prefix) $(DEST_BIN) \ chmod $(BINMOD) $(DEST_BIN)/xxd$(EXEEXT) -$(SHELL) ./installman.sh xxd $(DEST_MAN) "" $(INSTALLMANARGS) -$(SHELL) ./installman.sh xxd $(DEST_MAN_IT) "-it" $(INSTALLMANARGS) + -$(SHELL) ./installman.sh xxd $(DEST_MAN_IT_I) "-it" $(INSTALLMANARGS) -$(SHELL) ./installman.sh xxd $(DEST_MAN_IT_U) "-it.UTF-8" $(INSTALLMANARGS) -$(SHELL) ./installman.sh xxd $(DEST_MAN_RU) "-ru" $(INSTALLMANARGS) -$(SHELL) ./installman.sh xxd $(DEST_MAN_RU_U) "-ru.UTF-8" $(INSTALLMANARGS) @@ -1825,12 +1846,15 @@ installtools: $(TOOLS) $(DESTDIR)$(exec_prefix) $(DEST_BIN) \ # install the language specific files, if they were unpacked install-languages: languages $(DEST_LANG) $(DEST_KMAP) -$(SHELL) ./installman.sh install $(DEST_MAN_IT) "-it" $(INSTALLMANARGS) + -$(SHELL) ./installman.sh install $(DEST_MAN_IT_I) "-it" $(INSTALLMANARGS) -$(SHELL) ./installman.sh install $(DEST_MAN_IT_U) "-it.UTF-8" $(INSTALLMANARGS) -$(SHELL) ./installman.sh install $(DEST_MAN_RU) "-ru" $(INSTALLMANARGS) -$(SHELL) ./installman.sh install $(DEST_MAN_RU_U) "-ru.UTF-8" $(INSTALLMANARGS) -$(SHELL) ./installml.sh install "$(GUI_MAN_TARGETS)" \ $(DEST_MAN_IT) $(INSTALLMLARGS) -$(SHELL) ./installml.sh install "$(GUI_MAN_TARGETS)" \ + $(DEST_MAN_IT_I) $(INSTALLMLARGS) + -$(SHELL) ./installml.sh install "$(GUI_MAN_TARGETS)" \ $(DEST_MAN_IT_U) $(INSTALLMLARGS) -$(SHELL) ./installml.sh install "$(GUI_MAN_TARGETS)" \ $(DEST_MAN_RU) $(INSTALLMLARGS) @@ -1895,7 +1919,8 @@ $(DESTDIR)$(exec_prefix) $(DEST_BIN) \ $(DEST_VIM) $(DEST_RT) $(DEST_HELP) \ $(DEST_PRINT) $(DEST_COL) $(DEST_SYN) $(DEST_IND) $(DEST_FTP) \ $(DEST_LANG) $(DEST_KMAP) $(DEST_COMP) \ - $(DEST_MACRO) $(DEST_TOOLS) $(DEST_TUTOR) $(DEST_PLUG): + $(DEST_MACRO) $(DEST_TOOLS) $(DEST_TUTOR) $(DEST_SPELL) \ + $(DEST_PLUG): -$(SHELL) ./mkinstalldirs $@ -chmod $(DIRMOD) $@ @@ -1982,6 +2007,7 @@ uninstall: uninstall_runtime uninstall_runtime: -$(SHELL) ./installman.sh uninstall $(DEST_MAN) "" $(INSTALLMANARGS) -$(SHELL) ./installman.sh uninstall $(DEST_MAN_IT) "" $(INSTALLMANARGS) + -$(SHELL) ./installman.sh uninstall $(DEST_MAN_IT_I) "" $(INSTALLMANARGS) -$(SHELL) ./installman.sh uninstall $(DEST_MAN_IT_U) "" $(INSTALLMANARGS) -$(SHELL) ./installman.sh uninstall $(DEST_MAN_RU) "" $(INSTALLMANARGS) -$(SHELL) ./installman.sh uninstall $(DEST_MAN_RU_U) "" $(INSTALLMANARGS) @@ -1990,13 +2016,15 @@ uninstall_runtime: -$(SHELL) ./installml.sh uninstall "$(GUI_MAN_TARGETS)" \ $(DEST_MAN_IT) $(INSTALLMLARGS) -$(SHELL) ./installml.sh uninstall "$(GUI_MAN_TARGETS)" \ + $(DEST_MAN_IT_I) $(INSTALLMLARGS) + -$(SHELL) ./installml.sh uninstall "$(GUI_MAN_TARGETS)" \ $(DEST_MAN_IT_U) $(INSTALLMLARGS) -$(SHELL) ./installml.sh uninstall "$(GUI_MAN_TARGETS)" \ $(DEST_MAN_RU) $(INSTALLMLARGS) -$(SHELL) ./installml.sh uninstall "$(GUI_MAN_TARGETS)" \ $(DEST_MAN_RU_U) $(INSTALLMLARGS) -rm -f $(DEST_MAN)/xxd.1 - -rm -f $(DEST_MAN_IT)/xxd.1 $(DEST_MAN_IT_U)/xxd.1 + -rm -f $(DEST_MAN_IT)/xxd.1 $(DEST_MAN_IT_I)/xxd.1 $(DEST_MAN_IT_U)/xxd.1 -rm -f $(DEST_MAN_RU)/xxd.1 $(DEST_MAN_RU_U)/xxd.1 -rm -f $(DEST_HELP)/*.txt $(DEST_HELP)/tags $(DEST_HELP)/*.pl -rm -f $(DEST_HELP)/*.??x $(DEST_HELP)/tags-?? @@ -2012,6 +2040,7 @@ uninstall_runtime: -rm -f $(DEST_IND)/*.vim $(DEST_IND)/README.txt -rm -rf $(DEST_MACRO) -rm -rf $(DEST_TUTOR) + -rm -rf $(DEST_SPELL) -rm -rf $(DEST_TOOLS) -rm -rf $(DEST_LANG) -rm -rf $(DEST_KMAP) @@ -2365,6 +2394,9 @@ objects/screen.o: screen.c objects/search.o: search.c $(CCC) -o $@ search.c +objects/spell.o: spell.c + $(CCC) -o $@ spell.c + objects/syntax.o: syntax.c $(CCC) -o $@ syntax.c @@ -2643,6 +2675,10 @@ objects/search.o: search.c vim.h auto/config.h feature.h os_unix.h \ auto/osdef.h ascii.h keymap.h term.h macros.h structs.h regexp.h \ gui.h gui_beval.h proto/gui_beval.pro option.h ex_cmds.h proto.h \ globals.h farsi.h arabic.h +objects/spell.o: spell.c vim.h auto/config.h feature.h os_unix.h \ + auto/osdef.h ascii.h keymap.h term.h macros.h structs.h regexp.h \ + gui.h gui_beval.h proto/gui_beval.pro option.h ex_cmds.h proto.h \ + globals.h farsi.h arabic.h objects/syntax.o: syntax.c vim.h auto/config.h feature.h os_unix.h \ auto/osdef.h ascii.h keymap.h term.h macros.h structs.h regexp.h \ gui.h gui_beval.h proto/gui_beval.pro option.h ex_cmds.h proto.h \ diff --git a/src/charset.c b/src/charset.c index be908ed5d..b51d07208 100644 --- a/src/charset.c +++ b/src/charset.c @@ -394,8 +394,8 @@ transstr(s) #if defined(FEAT_SYN_HL) || defined(FEAT_INS_EXPAND) || defined(PROTO) /* - * Convert the string "p[len]" to do ignore-case comparing. Uses the current - * locale. + * Convert the string "str[orglen]" to do ignore-case comparing. Uses the + * current locale. * When "buf" is NULL returns an allocated string (NULL for out-of-memory). * Otherwise puts the result in "buf[buflen]". */ diff --git a/src/edit.c b/src/edit.c index 3a3e86596..39fc0ee0a 100644 --- a/src/edit.c +++ b/src/edit.c @@ -126,6 +126,9 @@ static void insert_special __ARGS((int, int, int)); static void check_auto_format __ARGS((int)); static void redo_literal __ARGS((int c)); static void start_arrow __ARGS((pos_T *end_insert_pos)); +#ifdef FEAT_SYN_HL +static void check_spell_redraw __ARGS((void)); +#endif static void stop_insert __ARGS((pos_T *end_insert_pos, int esc)); static int echeck_abbr __ARGS((int)); static void replace_push_off __ARGS((int c)); @@ -880,6 +883,9 @@ doESCkey: /* * This is the ONLY return from edit()! */ +#ifdef FEAT_SYN_HL + check_spell_redraw(); +#endif /* Always update o_lnum, so that a "CTRL-O ." that adds a line * still puts the cursor back after the inserted text. */ if (o_eol && gchar_cursor() == NUL) @@ -3958,6 +3964,11 @@ get_literal() if (cc == 0) /* NUL is stored as NL */ cc = '\n'; +#ifdef FEAT_MBYTE + if (enc_dbcs && (cc & 0xff) == 0) + cc = '?'; /* don't accept an illegal DBCS char, the NUL in the + second byte will cause trouble! */ +#endif --no_mapping; #ifdef FEAT_GUI @@ -4774,8 +4785,29 @@ start_arrow(end_insert_pos) stop_insert(end_insert_pos, FALSE); arrow_used = TRUE; /* this means we stopped the current insert */ } +#ifdef FEAT_SYN_HL + check_spell_redraw(); +#endif } +#ifdef FEAT_SYN_HL +/* + * If we skipped highlighting word at cursor, do it now. + * It may be skipped again, thus reset spell_redraw_lnum first. + */ + static void +check_spell_redraw() +{ + if (spell_redraw_lnum != 0) + { + linenr_T lnum = spell_redraw_lnum; + + spell_redraw_lnum = 0; + redrawWinline(lnum, FALSE); + } +} +#endif + /* * stop_arrow() is called before a change is made in insert mode. * If an arrow key has been used, start a new insertion. diff --git a/src/globals.h b/src/globals.h index 48738d004..1253f35d1 100644 --- a/src/globals.h +++ b/src/globals.h @@ -1220,6 +1220,10 @@ EXTERN int virtual_op INIT(= MAYBE); #ifdef FEAT_SYN_HL /* Display tick, incremented for each call to update_screen() */ EXTERN disptick_T display_tick INIT(= 0); + +/* Line in which spell checking wasn't highlighted because it touched the + * cursor position in Insert mode. */ +EXTERN linenr_T spell_redraw_lnum INIT(= 0); #endif #ifdef ALT_X_INPUT diff --git a/src/mbyte.c b/src/mbyte.c index 89b53c2e5..695b651bb 100644 --- a/src/mbyte.c +++ b/src/mbyte.c @@ -990,6 +990,10 @@ dbcs_char2bytes(c, buf) { buf[0] = (unsigned)c >> 8; buf[1] = c; + /* Never use a NUL byte, it causes lots of trouble. It's an invalid + * character anyway. */ + if (buf[1] == NUL) + buf[1] = '\n'; return 2; } buf[0] = c; @@ -3087,7 +3091,14 @@ iconv_string(vcp, str, slen, unconvlenp) *to++ = '?'; if ((*mb_ptr2cells)((char_u *)from) > 1) *to++ = '?'; - l = (*mb_ptr2len_check)((char_u *)from); + if (enc_utf8) + l = utfc_ptr2len_check_len((char_u *)from, fromlen); + else + { + l = (*mb_ptr2len_check)((char_u *)from); + if (l > fromlen) + l = fromlen; + } from += l; fromlen -= l; } diff --git a/src/option.c b/src/option.c index 30d7e896d..b4593a7e0 100644 --- a/src/option.c +++ b/src/option.c @@ -119,8 +119,10 @@ typedef enum , PV_SCBIND , PV_SCROLL , PV_SI - , PV_STL , PV_SN + , PV_SPELL + , PV_SPL + , PV_STL , PV_STS , PV_SUA , PV_SW @@ -232,6 +234,7 @@ static long p_sw; static int p_swf; #ifdef FEAT_SYN_HL static char_u *p_syn; +static char_u *p_spl; #endif static long p_ts; static long p_tw; @@ -1108,7 +1111,7 @@ static struct vimoption {(char_u *)FALSE, (char_u *)0L}}, {"highlight", "hl", P_STRING|P_VI_DEF|P_RCLR|P_COMMA|P_NODUP, (char_u *)&p_hl, PV_NONE, - {(char_u *)"8:SpecialKey,@:NonText,d:Directory,e:ErrorMsg,i:IncSearch,l:Search,m:MoreMsg,M:ModeMsg,n:LineNr,r:Question,s:StatusLine,S:StatusLineNC,c:VertSplit,t:Title,v:Visual,V:VisualNOS,w:WarningMsg,W:WildMenu,f:Folded,F:FoldColumn,A:DiffAdd,C:DiffChange,D:DiffDelete,T:DiffText,>:SignColumn", + {(char_u *)"8:SpecialKey,@:NonText,d:Directory,e:ErrorMsg,i:IncSearch,l:Search,m:MoreMsg,M:ModeMsg,n:LineNr,r:Question,s:StatusLine,S:StatusLineNC,c:VertSplit,t:Title,v:Visual,V:VisualNOS,w:WarningMsg,W:WildMenu,f:Folded,F:FoldColumn,A:DiffAdd,C:DiffChange,D:DiffDelete,T:DiffText,>:SignColumn,B:SpellBad,R:SpellRare,L:SpellLocal", (char_u *)0L}}, {"history", "hi", P_NUM|P_VIM, (char_u *)&p_hi, PV_NONE, @@ -2019,6 +2022,22 @@ static struct vimoption {"sourceany", NULL, P_BOOL|P_VI_DEF, (char_u *)NULL, PV_NONE, {(char_u *)FALSE, (char_u *)0L}}, + {"spell", NULL, P_BOOL|P_VI_DEF|P_RWIN, +#ifdef FEAT_SYN_HL + (char_u *)VAR_WIN, PV_SPELL, +#else + (char_u *)NULL, PV_NONE, +#endif + {(char_u *)FALSE, (char_u *)0L}}, + {"spelllang", "spl", P_STRING|P_ALLOCED|P_VI_DEF|P_COMMA, +#ifdef FEAT_SYN_HL + (char_u *)&p_spl, PV_SPL, + {(char_u *)"", (char_u *)0L} +#else + (char_u *)NULL, PV_NONE, + {(char_u *)0L, (char_u *)0L} +#endif + }, {"splitbelow", "sb", P_BOOL|P_VI_DEF, #ifdef FEAT_WINDOWS (char_u *)&p_sb, PV_NONE, @@ -2978,6 +2997,10 @@ set_init_1() /* $HOME may have characters in active code page. */ init_homedir(); # endif +#ifdef FEAT_SYN_HL + /* Need to reload spell dictionaries */ + spell_reload(); +#endif } else { @@ -4583,6 +4606,7 @@ check_buf_options(buf) #endif #ifdef FEAT_SYN_HL check_string_option(&buf->b_p_syn); + check_string_option(&buf->b_p_spl); #endif #ifdef FEAT_SEARCHPATH check_string_option(&buf->b_p_sua); @@ -5631,6 +5655,14 @@ did_set_string_option(opt_idx, varp, new_value_alloced, oldval, errbuf, errmsg = check_clipboard_option(); #endif +#ifdef FEAT_SYN_HL + /* When 'spellang' is set, load the wordlists. */ + else if (varp == &(curbuf->b_p_spl)) + { + errmsg = did_set_spelllang(curbuf); + } +#endif + #ifdef FEAT_AUTOCMD # ifdef FEAT_SYN_HL /* When 'syntax' is set, load the syntax of that name */ @@ -8111,6 +8143,9 @@ get_varp(p) case PV_ARAB: return (char_u *)&(curwin->w_p_arab); #endif case PV_LIST: return (char_u *)&(curwin->w_p_list); +#ifdef FEAT_SYN_HL + case PV_SPELL: return (char_u *)&(curwin->w_p_spell); +#endif #ifdef FEAT_DIFF case PV_DIFF: return (char_u *)&(curwin->w_p_diff); #endif @@ -8238,6 +8273,7 @@ get_varp(p) case PV_SWF: return (char_u *)&(curbuf->b_p_swf); #ifdef FEAT_SYN_HL case PV_SYN: return (char_u *)&(curbuf->b_p_syn); + case PV_SPL: return (char_u *)&(curbuf->b_p_spl); #endif case PV_SW: return (char_u *)&(curbuf->b_p_sw); case PV_TS: return (char_u *)&(curbuf->b_p_ts); @@ -8318,6 +8354,9 @@ copy_winopt(from, to) #ifdef FEAT_SCROLLBIND to->wo_scb = from->wo_scb; #endif +#ifdef FEAT_SYN_HL + to->wo_spell = from->wo_spell; +#endif #ifdef FEAT_DIFF to->wo_diff = from->wo_diff; #endif @@ -8544,6 +8583,8 @@ buf_copy_options(buf, flags) #ifdef FEAT_SYN_HL /* Don't copy 'syntax', it must be set */ buf->b_p_syn = empty_option; + buf->b_p_spl = vim_strsave(p_spl); + did_set_spelllang(buf); #endif #if defined(FEAT_CINDENT) && defined(FEAT_EVAL) buf->b_p_inde = vim_strsave(p_inde); diff --git a/src/proto/syntax.pro b/src/proto/syntax.pro index 82cebceb2..34fbcb870 100644 --- a/src/proto/syntax.pro +++ b/src/proto/syntax.pro @@ -4,7 +4,7 @@ void syn_stack_free_all __ARGS((buf_T *buf)); void syn_stack_apply_changes __ARGS((buf_T *buf)); void syntax_end_parsing __ARGS((linenr_T lnum)); int syntax_check_changed __ARGS((linenr_T lnum)); -int get_syntax_attr __ARGS((colnr_T col)); +int get_syntax_attr __ARGS((colnr_T col, int *can_spell)); void syntax_clear __ARGS((buf_T *buf)); void ex_syntax __ARGS((exarg_T *eap)); int syntax_present __ARGS((buf_T *buf)); @@ -21,6 +21,7 @@ char_u *hl_get_font_name __ARGS((void)); void hl_set_font_name __ARGS((char_u *font_name)); void hl_set_bg_color_name __ARGS((char_u *name)); void hl_set_fg_color_name __ARGS((char_u *name)); +int hl_combine_attr __ARGS((int char_attr, int spell_attr)); attrentry_T *syn_gui_attr2entry __ARGS((int attr)); attrentry_T *syn_term_attr2entry __ARGS((int attr)); attrentry_T *syn_cterm_attr2entry __ARGS((int attr)); diff --git a/src/screen.c b/src/screen.c index 933326f9e..fe3368579 100644 --- a/src/screen.c +++ b/src/screen.c @@ -2501,6 +2501,11 @@ win_line(wp, lnum, startrow, endrow) int syntax_attr = 0; /* attributes desired by syntax */ int has_syntax = FALSE; /* this buffer has syntax highl. */ int save_did_emsg; + int has_spell = FALSE; /* this buffer has spell checking */ + int spell_attr = 0; /* attributes desired by spelling */ + int word_end = 0; /* last byte with same spell_attr */ + int iswordc; /* prev. char was a word character */ + int prev_iswordc = FALSE; /* prev. char was a word character */ #endif int extra_check; /* has syntax or linebreak */ #ifdef FEAT_MBYTE @@ -2597,6 +2602,13 @@ win_line(wp, lnum, startrow, endrow) extra_check = TRUE; } } + + if (wp->w_p_spell && *wp->w_buffer->b_p_spl != NUL) + { + /* Prepare for spell checking. */ + has_spell = TRUE; + extra_check = TRUE; + } #endif /* @@ -3231,6 +3243,11 @@ win_line(wp, lnum, startrow, endrow) else char_attr = search_attr; +#ifdef FEAT_SYN_HL + if (spell_attr != 0) + char_attr = hl_combine_attr(char_attr, spell_attr); +#endif + #ifdef FEAT_DIFF if (diff_hlf != (enum hlf_value)0 && n_extra == 0) { @@ -3539,16 +3556,20 @@ win_line(wp, lnum, startrow, endrow) if (extra_check) { #ifdef FEAT_SYN_HL + int can_spell = TRUE; + /* Get syntax attribute, unless still at the start of the line * (double-wide char that doesn't fit). */ - if (has_syntax && (v = (long)(ptr - line)) > 0) + v = (long)(ptr - line); + if (has_syntax && v > 0) { /* Get the syntax attribute for the character. If there * is an error, disable syntax highlighting. */ save_did_emsg = did_emsg; did_emsg = FALSE; - syntax_attr = get_syntax_attr((colnr_T)v - 1); + syntax_attr = get_syntax_attr((colnr_T)v - 1, + has_spell ? &can_spell : NULL); if (did_emsg) syntax_clear(wp->w_buffer); @@ -3563,10 +3584,51 @@ win_line(wp, lnum, startrow, endrow) if (area_attr == 0 && search_attr == 0) char_attr = syntax_attr; } + + /* Check spelling at the start of a word. + * Only do this when there is no syntax highlighting, there is + * on @Spell cluster or the current syntax item contains the + * @Spell cluster. */ + if (has_spell && v >= word_end) + { + if (!has_syntax || can_spell) + { + char_u *prev_ptr = ptr - ( +# ifdef FEAT_MBYTE + has_mbyte ? mb_l : +# endif + 1); + + spell_attr = 0; + iswordc = vim_iswordc_buf(prev_ptr, wp->w_buffer); + if (iswordc && !prev_iswordc) + { + word_end = v + spell_check(wp, prev_ptr, + &spell_attr); + /* In Insert mode only highlight a word that + * doesn't touch the cursor. */ + if (spell_attr != 0 + && (State & INSERT) != 0 + && wp->w_cursor.lnum == lnum + && wp->w_cursor.col >= + (colnr_T)(prev_ptr - line) + && wp->w_cursor.col < (colnr_T)word_end) + { + spell_attr = 0; + spell_redraw_lnum = lnum; + } + } + prev_iswordc = iswordc; + } + else + spell_attr = 0; + } + if (spell_attr != 0) + char_attr = hl_combine_attr(char_attr, spell_attr); #endif #ifdef FEAT_LINEBREAK /* - * Found last space before word: check for line break + * Found last space before word: check for line break. */ if (wp->w_p_lbr && vim_isbreak(c) && !vim_isbreak(*ptr) && !wp->w_p_list) diff --git a/src/structs.h b/src/structs.h index 03379ad4d..78f292944 100644 --- a/src/structs.h +++ b/src/structs.h @@ -189,6 +189,10 @@ typedef struct #endif long wo_scr; #define w_p_scr w_onebuf_opt.wo_scr /* 'scroll' */ +#ifdef FEAT_SYN_HL + int wo_spell; +#define w_p_spell w_onebuf_opt.wo_spell /* 'spell' */ +#endif #ifdef FEAT_STL_OPT char_u *wo_stl; #define w_p_stl w_onebuf_opt.wo_stl /* 'statusline' */ @@ -1337,6 +1341,7 @@ struct file_buffer int b_p_swf; /* 'swapfile' */ #ifdef FEAT_SYN_HL char_u *b_p_syn; /* 'syntax' */ + char_u *b_p_spl; /* 'spelllang' */ #endif long b_p_ts; /* 'tabstop' */ int b_p_tx; /* 'textmode' */ @@ -1418,6 +1423,7 @@ struct file_buffer int b_syn_ic; /* ignore case for :syn cmds */ garray_T b_syn_patterns; /* table for syntax patterns */ garray_T b_syn_clusters; /* table for syntax clusters */ + int b_spell_cluster_id; /* @Spell cluster ID or 0 */ int b_syn_containedin; /* TRUE when there is an item with a "containedin" argument */ int b_syn_sync_flags; /* flags about how to sync */ @@ -1454,6 +1460,10 @@ struct file_buffer int b_sst_freecount; linenr_T b_sst_check_lnum; short_u b_sst_lasttick; /* last display tick */ + + /* for spell checking */ + garray_T b_langp; /* list of pointers to slang_T, see spell.c */ + #endif /* FEAT_SYN_HL */ #ifdef FEAT_SIGNS diff --git a/src/syntax.c b/src/syntax.c index 003b62430..662b8a59c 100644 --- a/src/syntax.c +++ b/src/syntax.c @@ -204,12 +204,12 @@ static int current_id = 0; /* ID of current char for syn_get_id() */ static int current_trans_id = 0; /* idem, transparancy removed */ #endif -struct syn_cluster +typedef struct syn_cluster_S { char_u *scl_name; /* syntax cluster name */ char_u *scl_name_u; /* uppercase of scl_name */ short *scl_list; /* IDs in this syntax cluster */ -}; +} syn_cluster_T; /* * Methods of combining two clusters @@ -218,7 +218,7 @@ struct syn_cluster #define CLUSTER_ADD 2 /* add second list to first */ #define CLUSTER_SUBTRACT 3 /* subtract second list from first */ -#define SYN_CLSTR(buf) ((struct syn_cluster *)((buf)->b_syn_clusters.ga_data)) +#define SYN_CLSTR(buf) ((syn_cluster_T *)((buf)->b_syn_clusters.ga_data)) /* * Syntax group IDs have different types: @@ -372,7 +372,7 @@ static void invalidate_current_state __ARGS((void)); static int syn_stack_equal __ARGS((synstate_T *sp)); static void validate_current_state __ARGS((void)); static int syn_finish_line __ARGS((int syncing)); -static int syn_current_attr __ARGS((int syncing, int displaying)); +static int syn_current_attr __ARGS((int syncing, int displaying, int *can_spell)); static int did_match_already __ARGS((int idx, garray_T *gap)); static stateitem_T *push_next_match __ARGS((stateitem_T *cur_si)); static void check_state_ends __ARGS((void)); @@ -1660,7 +1660,7 @@ syn_finish_line(syncing) { while (!current_finished) { - (void)syn_current_attr(syncing, FALSE); + (void)syn_current_attr(syncing, FALSE, NULL); /* * When syncing, and found some item, need to check the item. */ @@ -1693,10 +1693,13 @@ syn_finish_line(syncing) * "col" is normally 0 for the first use in a line, and increments by one each * time. It's allowed to skip characters and to stop before the end of the * line. But only a "col" after a previously used column is allowed. + * When "can_spell" is not NULL set it to TRUE when spell-checking should be + * done. */ int -get_syntax_attr(col) +get_syntax_attr(col, can_spell) colnr_T col; + int *can_spell; { int attr = 0; @@ -1715,7 +1718,7 @@ get_syntax_attr(col) */ while (current_col <= col) { - attr = syn_current_attr(FALSE, TRUE); + attr = syn_current_attr(FALSE, TRUE, can_spell); ++current_col; } @@ -1727,9 +1730,10 @@ get_syntax_attr(col) * Get syntax attributes for current_lnum, current_col. */ static int -syn_current_attr(syncing, displaying) +syn_current_attr(syncing, displaying, can_spell) int syncing; /* When 1: called for syncing */ int displaying; /* result will be displayed */ + int *can_spell; /* return: do spell checking */ { int syn_id; lpos_T endpos; /* was: char_u *endp; */ @@ -1740,7 +1744,7 @@ syn_current_attr(syncing, displaying) int end_idx; /* group ID for end pattern */ int idx; synpat_T *spp; - stateitem_T *cur_si, *sip; + stateitem_T *cur_si, *sip = NULL; int startcol; int endcol; long flags; @@ -2166,6 +2170,9 @@ syn_current_attr(syncing, displaying) #endif if (cur_si != NULL) { +#ifndef FEAT_EVAL + int current_trans_id = 0; +#endif for (idx = current_state.ga_len - 1; idx >= 0; --idx) { sip = &CUR_STATE(idx); @@ -2180,12 +2187,36 @@ syn_current_attr(syncing, displaying) current_attr = sip->si_attr; #ifdef FEAT_EVAL current_id = sip->si_id; - current_trans_id = sip->si_trans_id; #endif + current_trans_id = sip->si_trans_id; break; } } + if (can_spell != NULL) + { + struct sp_syn sps; + + /* + * set "can_spell" to TRUE if spell checking is supposed to be + * done in the current item. + */ + + /* Always do spelling if there is no @Spell cluster. */ + if (syn_buf->b_spell_cluster_id == 0) + *can_spell = TRUE; + else if (current_trans_id == 0) + *can_spell = FALSE; + else + { + sps.inc_tag = 0; + sps.id = syn_buf->b_spell_cluster_id; + sps.cont_in_list = NULL; + *can_spell = in_id_list(sip, sip->si_cont_list, &sps, 0); + } + } + + /* * Check for end of current state (and the states before it) at the * next column. Don't do this for syncing, because we would miss a @@ -2205,6 +2236,9 @@ syn_current_attr(syncing, displaying) } } } + else if (can_spell != NULL) + /* Only do spelling when there is no @Spell cluster. */ + *can_spell = (syn_buf->b_spell_cluster_id == 0); /* nextgroup ends at end of line, unless "skipnl" or "skipemtpy" present */ if (current_next_list != NULL @@ -5029,16 +5063,16 @@ syn_check_cluster(pp, len) */ static int syn_add_cluster(name) - char_u *name; + char_u *name; { - int len; + int len; /* * First call for this growarray: init growing array. */ if (curbuf->b_syn_clusters.ga_data == NULL) { - curbuf->b_syn_clusters.ga_itemsize = sizeof(struct syn_cluster); + curbuf->b_syn_clusters.ga_itemsize = sizeof(syn_cluster_T); curbuf->b_syn_clusters.ga_growsize = 10; } @@ -5052,12 +5086,15 @@ syn_add_cluster(name) } len = curbuf->b_syn_clusters.ga_len; - vim_memset(&(SYN_CLSTR(curbuf)[len]), 0, sizeof(struct syn_cluster)); + vim_memset(&(SYN_CLSTR(curbuf)[len]), 0, sizeof(syn_cluster_T)); SYN_CLSTR(curbuf)[len].scl_name = name; SYN_CLSTR(curbuf)[len].scl_name_u = vim_strsave_up(name); SYN_CLSTR(curbuf)[len].scl_list = NULL; ++curbuf->b_syn_clusters.ga_len; + if (STRICMP(name, "Spell") == 0) + curbuf->b_spell_cluster_id = len + SYNID_CLUSTER; + return len + SYNID_CLUSTER; } @@ -5089,7 +5126,7 @@ syn_cmd_cluster(eap, syncing) if (rest != NULL) { scl_id = syn_check_cluster(arg, (int)(group_name_end - arg)) - - SYNID_CLUSTER; + - SYNID_CLUSTER; for (;;) { @@ -5896,7 +5933,7 @@ syn_get_id(lnum, col, trans) || col < (long)current_col) syntax_start(curwin, lnum); - (void)get_syntax_attr((colnr_T)col); + (void)get_syntax_attr((colnr_T)col, NULL); return (trans ? current_trans_id : current_id); } @@ -5968,6 +6005,9 @@ static char *(highlight_init_light[]) = "Normal gui=NONE", "Question term=standout ctermfg=DarkGreen gui=bold guifg=SeaGreen", "Search term=reverse ctermbg=Yellow ctermfg=NONE guibg=Yellow guifg=NONE", + "SpellBad term=reverse ctermbg=LightRed guisp=Red gui=undercurl", + "SpellRare term=reverse ctermbg=LightMagenta guisp=Magenta gui=undercurl", + "SpellLocal term=underline ctermbg=Cyan guisp=DarkCyan gui=undercurl", "SpecialKey term=bold ctermfg=DarkBlue guifg=Blue", "Title term=bold ctermfg=DarkMagenta gui=bold guifg=Magenta", "WarningMsg term=standout ctermfg=DarkRed guifg=Red", @@ -5990,6 +6030,9 @@ static char *(highlight_init_dark[]) = "Question term=standout ctermfg=LightGreen gui=bold guifg=Green", "Search term=reverse ctermbg=Yellow ctermfg=Black guibg=Yellow guifg=Black", "SpecialKey term=bold ctermfg=LightBlue guifg=Cyan", + "SpellBad term=reverse ctermbg=Red guisp=Red gui=undercurl", + "SpellRare term=reverse ctermbg=Magenta guisp=Magenta gui=undercurl", + "SpellLocal term=underline ctermbg=Cyan guisp=Cyan gui=undercurl", "Title term=bold ctermfg=LightMagenta gui=bold guifg=Magenta", "WarningMsg term=standout ctermfg=LightRed guifg=Red", "WildMenu term=standout ctermbg=Yellow ctermfg=Black guibg=Yellow guifg=Black", @@ -7519,6 +7562,128 @@ get_attr_entry(table, aep) return (table->ga_len - 1 + ATTR_OFF); } +#if defined(FEAT_SYN_HL) || defined(PROTO) +/* + * Combine the spelling attributes with other attributes. "spell_attr" + * overrules "char_attr". + * This creates a new group when required. + * Since we expect there to be few spelling mistakes we don't cache the + * result. + * Return the resulting attributes. + */ + int +hl_combine_attr(char_attr, spell_attr) + int char_attr; + int spell_attr; +{ + attrentry_T *char_aep = NULL; + attrentry_T *spell_aep; + attrentry_T new_en; + + if (char_attr == 0) + return spell_attr; + if (char_attr <= HL_ALL && spell_attr <= HL_ALL) + return char_attr | spell_attr; +#ifdef FEAT_GUI + if (gui.in_use) + { + if (char_attr > HL_ALL) + char_aep = syn_gui_attr2entry(char_attr); + if (char_aep != NULL) + new_en = *char_aep; + else + { + vim_memset(&new_en, 0, sizeof(new_en)); + if (char_attr <= HL_ALL) + new_en.ae_attr = char_attr; + } + + if (spell_attr <= HL_ALL) + new_en.ae_attr |= spell_attr; + else + { + spell_aep = syn_gui_attr2entry(spell_attr); + if (spell_aep != NULL) + { + new_en.ae_attr |= spell_aep->ae_attr; + if (spell_aep->ae_u.gui.fg_color != INVALCOLOR) + new_en.ae_u.gui.fg_color = spell_aep->ae_u.gui.fg_color; + if (spell_aep->ae_u.gui.bg_color != INVALCOLOR) + new_en.ae_u.gui.bg_color = spell_aep->ae_u.gui.bg_color; + if (spell_aep->ae_u.gui.sp_color != INVALCOLOR) + new_en.ae_u.gui.sp_color = spell_aep->ae_u.gui.sp_color; + if (spell_aep->ae_u.gui.font != NOFONT) + new_en.ae_u.gui.font = spell_aep->ae_u.gui.font; +# ifdef FEAT_XFONTSET + if (spell_aep->ae_u.gui.fontset != NOFONTSET) + new_en.ae_u.gui.fontset = spell_aep->ae_u.gui.fontset; +# endif + } + } + return get_attr_entry(&gui_attr_table, &new_en); + } +#endif + + if (t_colors > 1) + { + if (char_attr > HL_ALL) + char_aep = syn_cterm_attr2entry(char_attr); + if (char_aep != NULL) + new_en = *char_aep; + else + { + vim_memset(&new_en, 0, sizeof(new_en)); + if (char_attr <= HL_ALL) + new_en.ae_attr = char_attr; + } + + if (spell_attr <= HL_ALL) + new_en.ae_attr |= spell_attr; + else + { + spell_aep = syn_cterm_attr2entry(spell_attr); + if (spell_aep != NULL) + { + new_en.ae_attr |= spell_aep->ae_attr; + if (spell_aep->ae_u.cterm.fg_color > 0) + new_en.ae_u.cterm.fg_color = spell_aep->ae_u.cterm.fg_color; + if (spell_aep->ae_u.cterm.bg_color > 0) + new_en.ae_u.cterm.bg_color = spell_aep->ae_u.cterm.bg_color; + } + } + return get_attr_entry(&cterm_attr_table, &new_en); + } + + if (char_attr > HL_ALL) + char_aep = syn_term_attr2entry(char_attr); + if (char_aep != NULL) + new_en = *char_aep; + else + { + vim_memset(&new_en, 0, sizeof(new_en)); + if (char_attr <= HL_ALL) + new_en.ae_attr = char_attr; + } + + if (spell_attr <= HL_ALL) + new_en.ae_attr |= spell_attr; + else + { + spell_aep = syn_cterm_attr2entry(spell_attr); + if (spell_aep != NULL) + { + new_en.ae_attr |= spell_aep->ae_attr; + if (spell_aep->ae_u.term.start != NULL) + { + new_en.ae_u.term.start = spell_aep->ae_u.term.start; + new_en.ae_u.term.stop = spell_aep->ae_u.term.stop; + } + } + } + return get_attr_entry(&term_attr_table, &new_en); +} +#endif + #ifdef FEAT_GUI attrentry_T * diff --git a/src/version.h b/src/version.h index 2eaf3a360..5d04e57d5 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 Mar 18)" -#define VIM_VERSION_LONG_DATE "VIM - Vi IMproved 7.0aa ALPHA (2005 Mar 18, compiled " +#define VIM_VERSION_LONG "VIM - Vi IMproved 7.0aa ALPHA (2005 Mar 20)" +#define VIM_VERSION_LONG_DATE "VIM - Vi IMproved 7.0aa ALPHA (2005 Mar 20, compiled " |