changeset 493:06364aa0d597

updated for version 7.0135
author vimboss
date Tue, 23 Aug 2005 21:02:42 +0000
parents 81c06952fb1d
children acfe86afd651
files runtime/doc/eval.txt runtime/doc/options.txt runtime/doc/spell.txt runtime/spell/th/main.aap runtime/spell/yi/yi.diff src/globals.h src/ops.c src/version.h
diffstat 8 files changed, 156 insertions(+), 52 deletions(-) [+]
line wrap: on
line diff
--- a/runtime/doc/eval.txt
+++ b/runtime/doc/eval.txt
@@ -1,4 +1,4 @@
-*eval.txt*      For Vim version 7.0aa.  Last change: 2005 Aug 11
+*eval.txt*      For Vim version 7.0aa.  Last change: 2005 Aug 23
 
 
 		  VIM REFERENCE MANUAL    by Bram Moolenaar
@@ -2013,11 +2013,12 @@ cscope_connection([{num} , {dbpath} [, {
 <
 cursor({lnum}, {col})					*cursor()*
 		Positions the cursor at the column {col} in the line {lnum}.
+		The first column is one.
 		Does not change the jumplist.
 		If {lnum} is greater than the number of lines in the buffer,
 		the cursor will be positioned at the last line in the buffer.
 		If {lnum} is zero, the cursor will stay in the current line.
-		If {col} is greater than the number of characters in the line,
+		If {col} is greater than the number of bytes in the line,
 		the cursor will be positioned at the last character in the
 		line.
 		If {col} is zero, the cursor will stay in the current column.
--- a/runtime/doc/options.txt
+++ b/runtime/doc/options.txt
@@ -1,4 +1,4 @@
-*options.txt*	For Vim version 7.0aa.  Last change: 2005 Aug 21
+*options.txt*	For Vim version 7.0aa.  Last change: 2005 Aug 23
 
 
 		  VIM REFERENCE MANUAL	  by Bram Moolenaar
@@ -1200,9 +1200,10 @@ A jump table for the options with a shor
 	these words, separated by a comma:
 	internal	Use internal case mapping functions, the current
 			locale does not change the case mapping.  This only
-			matters when 'encoding' is a Unicode encoding.  When
-			"internal" is omitted, the towupper() and towlower()
-			system library functions are used when available.
+			matters when 'encoding' is a Unicode encoding,
+			"latin1" or "iso-8859-15".  When "internal" is
+			omitted, the towupper() and towlower() system library
+			functions are used when available.
 	keepascii	For the ASCII characters (0x00 to 0x7f) use the US
 			case mapping, the current locale is not effective.
 			This probably only matters for Turkish.
--- a/runtime/doc/spell.txt
+++ b/runtime/doc/spell.txt
@@ -1,4 +1,4 @@
-*spell.txt*	For Vim version 7.0aa.  Last change: 2005 Aug 22
+*spell.txt*	For Vim version 7.0aa.  Last change: 2005 Aug 23
 
 
 		  VIM REFERENCE MANUAL	  by Bram Moolenaar
@@ -145,7 +145,8 @@ z?			For the word under/after the cursor
 			different).
 			When a word was replaced the redo command "." will
 			repeat the word replacement.  This works like "ciw",
-			the good word and <Esc>.
+			the good word and <Esc>.  This does NOT work for Thai
+			and other languages without spaces between words.
 
 					*:spellr* *:spellrepall* *E752* *E753*
 :spellr[epall]		Repeat the replacement done by |z?| for all matches
@@ -435,8 +436,7 @@ then Vim will try to guess.
 			into one en.spl file.
 			Up to eight regions can be combined. *E754* *755*
 			The REP and SAL items of the first .aff file where
-			they appear are used. |spell-affix-REP|
-			|spell-affix-SAL|
+			they appear are used. |spell-REP| |spell-SAL|
 
 			This command uses a lot of memory, required to find
 			the optimal word tree (Polish, Italian and Hungarian
@@ -602,15 +602,6 @@ used to modify the basic words to get th
 reduces the number of words, especially for a language like Polish.  This is
 called affix compression.
 
-The format for the affix and word list files is mostly identical to what
-Myspell uses (the spell checker of Mozilla and OpenOffice.org).  A description
-can be found here:
-	http://lingucomponent.openoffice.org/affix.readme ~
-Note that affixes are case sensitive, this isn't obvious from the description.
-
-Vim supports a few extras.  Hopefully Myspell will support these too some day.
-See |spell-affix-vim|.
-
 The basic word list and the affix file are combined and turned into a binary
 spell file.  All the preprocessing has been done, thus this file loads fast.
 The binary spell file format is described in the source code (src/spell.c).
@@ -620,6 +611,19 @@ The preprocessing also allows us to take
 them before the Vim word list is made.  The tools for this can be found in the
 "src/spell" directory.
 
+The format for the affix and word list files is based on what Myspell uses
+(the spell checker of Mozilla and OpenOffice.org).  A description can be found
+here:
+	http://lingucomponent.openoffice.org/affix.readme ~
+Note that affixes are case sensitive, this isn't obvious from the description.
+
+Vim does not use the TRY item, it is ignored.  For making suggestions the
+possible characters in the words are used.
+
+Vim supports quite a few extras.  They are described below |spell-affix-vim|.
+Attempts have been made to keep this compatible with other spell checkers, so
+that the same files can be used.
+
 
 WORD LIST FORMAT				*spell-dic-format*
 
@@ -635,6 +639,7 @@ A very short example, with line numbers:
 	8	bedel/P
 	9	kado/1
 	10	cadeau/2
+	11	TCP,IP
 
 The first line contains the number of words.  Vim ignores it, but you do get
 an error message if it's not there.  *E760*
@@ -659,7 +664,7 @@ The word with all upper-case characters 
 	AlS		AlS ALS			als Als ALs aLs aLS
 
 The KEP affix ID can be used to specifically match a word with identical case
-only, see below |spell-affix-KEP|.
+only, see below |spell-KEP|.
 
 Note in line 5 to 7 that non-word characters are used.  You can include
 any character in a word.  When checking the text a word still only matches
@@ -671,6 +676,11 @@ letters that indicate the affixes that c
 specified with SFX and PFX lines in the .aff file.  See the Myspell
 documentation.
 
+In line 12 the word "TCP/IP" is defined.  Since the slash has a special
+meaning the comma is used instead.  This is defined with the SLASH item in the
+affix file, see |spell-SLASH|.  Note that without this SLASH item the
+word will be "TCP,IP".
+
 							*spell-affix-vim*
 A flag that Vim adds and is not in Myspell is the flag defined with KEP in the
 affix file.  This has the meaning that case matters.  This can be used if the
@@ -701,8 +711,8 @@ word characters (as specified with ENC).
 ":mkspell" is used may not support a locale with this encoding and isalpha()
 won't work.  For example when using "cp1250" on Unix.
 
-					*E761* *E762* *spell-affix-FOL*
-					*spell-affix-LOW* *spell-affix-UPP*
+						*E761* *E762* *spell-FOL*
+						*spell-LOW* *spell-UPP*
 Three lines in the affix file are needed.  Simplistic example:
 
 	FOL  áëñ ~
@@ -722,6 +732,10 @@ The "UPP" line specifies the characters 
 is upper-case where it's different from the character at the same position in
 "FOL".
 
+An exception is made for the German sharp s ß.  The upper-case version is
+"SS".  In the FOL/LOW/UPP lines it should be included, so that it's recognized
+as a word character, but use the ß character in all three.
+
 ASCII characters should be omitted, Vim always handles these in the same way.
 When the encoding is UTF-8 no word characters need to be specified.
 
@@ -754,7 +768,7 @@ These characters are defined with MIDWOR
 
 
 AFFIXES
-					    *spell-affix-PFX* *spell-affix-SFX*
+					    *spell-PFX* *spell-SFX*
 The usual PFX (prefix) and SFX (suffix) lines are supported (see the Myspell
 documentation or the Aspell manual:
 http://aspell.net/man-html/Affix-Compression.html).
@@ -793,7 +807,7 @@ Example:
 
 This allows for "wordutil" and "wordutils" but not "wordutilize".
 
-						    *spell-affix-PFXPOSTPONE*
+						    *spell-PFXPOSTPONE*
 When an affix file has very many prefixes that apply to many words it's not
 possible to build the whole word list in memory.  This applies to Hebrew (a
 list with all words is over a Gbyte).  In that case applying prefixes must be
@@ -809,7 +823,7 @@ but in lower case.  Thus when the chop s
 word to start with an upper case letter.
 
 
-WORDS WITH A SLASH					*spell-affix-SLASH*
+WORDS WITH A SLASH					*spell-SLASH*
 
 The slash is used in the .dic file to separate the basic word from the affix
 letters that can be used.  Unfortunately, this means you cannot use a slash in
@@ -824,7 +838,7 @@ Of course, the letter used should itself
 must be ASCII, thus a single byte.
 
 
-KEEP-CASE WORDS						*spell-affix-KEP*
+KEEP-CASE WORDS						*spell-KEP*
 
 In the affix file a KEP line can be used to define the affix name used for
 keep-case words.  Example:
@@ -834,7 +848,7 @@ keep-case words.  Example:
 See above for an example |spell-affix-vim|.
 
 
-RARE WORDS						*spell-affix-RAR*
+RARE WORDS						*spell-RAR*
 
 In the affix file a RAR line can be used to define the affix name used for
 rare words.  Example:
@@ -847,7 +861,7 @@ a typing mistake anyway.  When the same 
 highlighted as rare.
 
 
-BAD WORDS						*spell-affix-BAD*
+BAD WORDS						*spell-BAD*
 
 In the affix file a BAD line can be used to define the affix name used for
 bad words.  Example:
@@ -862,14 +876,14 @@ This can be used to exclude words that w
 Once a word has been marked as bad it won't be undone by encountering the same
 word as good.
 
-							*spell-affix-NEEDAFFIX*
+							*spell-NEEDAFFIX*
 The NEEDAFFIX flag is used to require that a word is used with an affix.  The
 word itself is not a good word.  Example:
 
 	NEEDAFFIX + ~
 
 
-COMPOUND WORDS						*spell-affix-compound*
+COMPOUND WORDS						*spell-compound*
 
 A compound word is a longer word made by concatenating words that appear in
 the .dic file.  To specify which words may be concatenated a character is
@@ -988,6 +1002,17 @@ Above another way to restrict compoundin
 after an affix causes all words that are made with that affix not be be used
 for compounding. |spell-affix-nocomp|
 
+
+UNLIMITED COMPOUNDING					*spell-NOBREAK*
+
+For some languages, such as Thai, there is no space in between words.  This
+looks like all words are compounded.  To specify this use the NOBREAK item in
+the affix file, without arguments:
+	NOBREAK ~
+
+Vim will try to figure out where one word ends and a next starts.  When there
+are spelling mistakes this may not be quite right.
+
 >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
 NOTE: The following has not been implemented yet, because there are no word
 lists that support this.
@@ -1028,7 +1053,7 @@ lists that support this.
 >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
 
 
-REPLACEMENTS						*spell-affix-REP*
+REPLACEMENTS						*spell-REP*
 
 In the affix file REP items can be used to define common mistakes.  This is
 used to make spelling suggestions.  The items define the "from" text and the
@@ -1046,7 +1071,7 @@ anyway.  You can include whole words if 
 the "file:" item in 'spellsuggest' instead.
 
 
-SIMILAR CHARACTERS					*spell-affix-MAP*
+SIMILAR CHARACTERS					*spell-MAP*
 
 In the affix file MAP items can be used to define letters that are very much
 alike.  This is mostly used for a letter with different accents.  This is used
@@ -1062,7 +1087,7 @@ Each letter must appear in only one of t
 efficient if the first letter is ASCII or at least one without accents.
 
 
-SOUND-A-LIKE						*spell-affix-SAL*
+SOUND-A-LIKE						*spell-SAL*
 
 In the affix file SAL items can be used to define the sounds-a-like mechanism
 to be used.  The main items define the "from" text and the "to" replacement.
@@ -1086,7 +1111,7 @@ There are a few special items:
 "1" has the same meaning as "true".  Any other value means "false".
 
 
-SIMPLE SOUNDFOLDING		*spell-affix-SOFOFROM* *spell-affix-SOFOTO*
+SIMPLE SOUNDFOLDING				*spell-SOFOFROM* *spell-SOFOTO*
 
 The SAL mechanism is complex and slow.  A simpler mechanism is mapping all
 characters to another character, mapping similar sounding characters to the
new file mode 100644
--- /dev/null
+++ b/runtime/spell/th/main.aap
@@ -0,0 +1,66 @@
+# Aap recipe for Thai Vim spell files.
+
+# Use a freshly compiled Vim if it exists.
+@if os.path.exists('../../../src/vim'):
+    VIM = ../../../src/vim
+@else:
+    :progsearch VIM vim
+
+SPELLDIR = ..
+FILES    = th.aff th.dic
+
+all: $SPELLDIR/th.utf-8.spl ../README_th.txt
+
+$SPELLDIR/th.utf-8.spl : $FILES
+        :sys $VIM -u NONE -e -c "set enc=utf-8"
+                -c "mkspell! $SPELLDIR/th th" -c q
+
+../README_th.txt: README_th.txt
+        :copy $source $target
+
+#
+# Fetching the files from http://sesrc.th.net
+#
+HTTPDIR = http://seasrc.th.net/dict
+ZIPNAME = th_18057.zip
+FNAME = TH_18057.TXT
+
+:attr {fetch = $HTTPDIR/%file%} $ZIPNAME
+
+# The files don't depend on the .zip file so that we can delete it.
+# Only download the zip file if the targets don't exist.
+# This is a bit tricky, since the file name includes the date.
+#
+# We get a plain list of Thai words and make the .dic file from that.  The .aff
+# file is made from scratch.
+th.aff th.dic: {buildcheck=}
+        :assertpkg unzip iconv
+        :fetch $ZIPNAME
+        :sys unzip $ZIPNAME
+        :sys {force} iconv -c -f TIS-620 -t UTF-8 <$FNAME >th.dic
+        :delete $ZIPNAME $FNAME
+
+        :delete {force} th.aff
+        :touch {force} th.aff
+        @if not os.path.exists('th.orig.aff'):
+            :touch {force} th.orig.aff
+        @if not os.path.exists('th.orig.dic'):
+            :copy th.dic th.orig.dic
+        @if os.path.exists('th.diff'):
+            :sys patch <th.diff
+
+
+# Generate diff files, so that others can get the OpenOffice files and apply
+# the diffs to get the Vim versions.
+
+diff:
+        :assertpkg diff
+        :sys {force} diff -N -a -C 1 th.orig.aff th.aff >th.diff
+        :sys {force} diff -a -C 1 th.orig.dic th.dic >>th.diff
+
+
+# Check for updated spell files.  When there are changes the
+# ".new.aff" and ".new.dic" files are left behind for manual inspection.
+
+check:
+        :print Sorry, not supported.
--- a/runtime/spell/yi/yi.diff
+++ b/runtime/spell/yi/yi.diff
@@ -6,7 +6,7 @@
 + 999999
   גרונטעלעמענט
   דזש×ָבענדיקס
-*** /dev/null	Fri Aug 19 23:01:14 2005
+*** /dev/null	Tue Aug 23 22:51:11 2005
 --- yi.aff	Mon Aug 15 23:06:00 2005
 ***************
 *** 0 ****
--- a/src/globals.h
+++ b/src/globals.h
@@ -688,6 +688,7 @@ EXTERN int	enc_dbcs INIT(= 0);		/* One o
 						   DBCS encoding */
 EXTERN int	enc_unicode INIT(= 0);	/* 2: UCS-2 or UTF-16, 4: UCS-4 */
 EXTERN int	enc_utf8 INIT(= FALSE);		/* UTF-8 encoded Unicode */
+EXTERN int	enc_latin1like INIT(= TRUE);	/* 'encoding' is latin1 comp. */
 # ifdef WIN3264
 /* Codepage nr of 'encoding'.  Negative means it's not been set yet, zero
  * means 'encoding' is not a valid codepage. */
--- a/src/ops.c
+++ b/src/ops.c
@@ -2140,12 +2140,9 @@ op_tilde(oap)
     pos_T		pos;
 #ifdef FEAT_VISUAL
     struct block_def	bd;
-    int			done;
-#endif
+#endif
+    int			todo;
     int			did_change = 0;
-#ifdef FEAT_MBYTE
-    colnr_T		col;
-#endif
 
     if (u_save((linenr_T)(oap->start.lnum - 1),
 				       (linenr_T)(oap->end.lnum + 1)) == FAIL)
@@ -2159,19 +2156,15 @@ op_tilde(oap)
 	{
 	    block_prep(oap, &bd, pos.lnum, FALSE);
 	    pos.col = bd.textcol;
-	    for (done = 0; done < bd.textlen; ++done)
+	    for (todo = bd.textlen; todo > 0; --todo)
 	    {
+#ifdef FEAT_MBYTE
+		if (has_mbyte)
+		    todo -= (*mb_ptr2len)(ml_get_pos(&pos)) - 1;
+#endif
 		did_change |= swapchar(oap->op_type, &pos);
-# ifdef FEAT_MBYTE
-		col = pos.col + 1;
-# endif
 		if (inc(&pos) == -1)	    /* at end of file */
 		    break;
-# ifdef FEAT_MBYTE
-		if (pos.col > col)
-		    /* Count extra bytes of a multi-byte character. */
-		    done += pos.col - col;
-# endif
 	    }
 # ifdef FEAT_NETBEANS_INTG
 	    if (usingNetbeans && did_change)
@@ -2202,8 +2195,12 @@ op_tilde(oap)
 	else if (!oap->inclusive)
 	    dec(&(oap->end));
 
-	while (ltoreq(pos, oap->end))
+	for (todo = oap->end.col - pos.col + 1; todo > 0; --todo)
 	{
+#ifdef FEAT_MBYTE
+	    if (has_mbyte)
+		todo -= (*mb_ptr2len)(ml_get_pos(&pos)) - 1;
+#endif
 	    did_change |= swapchar(oap->op_type, &pos);
 	    if (inc(&pos) == -1)    /* at end of file */
 		break;
@@ -2282,6 +2279,19 @@ swapchar(op_type, pos)
 	return FALSE;
 
 #ifdef FEAT_MBYTE
+    if (op_type == OP_UPPER && enc_latin1like && c == 0xdf)
+    {
+	pos_T   sp = curwin->w_cursor;
+
+	/* Special handling of German sharp s: change to "SS". */
+	curwin->w_cursor = *pos;
+	del_char(FALSE);
+	ins_char('S');
+	ins_char('S');
+	curwin->w_cursor = sp;
+	inc(pos);
+    }
+
     if (enc_dbcs != 0 && c >= 0x100)	/* No lower/uppercase letter */
 	return FALSE;
 #endif
--- 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 Aug 23)"
-#define VIM_VERSION_LONG_DATE	"VIM - Vi IMproved 7.0aa ALPHA (2005 Aug 23, compiled "
+#define VIM_VERSION_LONG	"VIM - Vi IMproved 7.0aa ALPHA (2005 Aug 24)"
+#define VIM_VERSION_LONG_DATE	"VIM - Vi IMproved 7.0aa ALPHA (2005 Aug 24, compiled "