• R/O
  • SSH

vim: Commit

Mirror of the Vim source from https://github.com/vim/vim


Commit MetaInfo

Revision4fbfecbb968cf990066c5d7304266a07e0c7528e (tree)
Time2019-11-08 05:00:05
AuthorBram Moolenaar <Bram@vim....>
CommiterBram Moolenaar

Log Message

patch 8.1.2268: spell file flag zero is not recognized

Commit: https://github.com/vim/vim/commit/3d2a47c7823b934e1a85d773b68758c87c3ddc90
Author: Bram Moolenaar <Bram@vim.org>
Date: Thu Nov 7 20:48:42 2019 +0100

patch 8.1.2268: spell file flag zero is not recognized
Problem: Spell file flag zero is not recognized.
Solution: Use -1 as an error value, so that zero can be used as a valid flag
number.

Change Summary

Incremental Difference

diff -r 2602ebaedfda -r 4fbfecbb968c src/spellfile.c
--- a/src/spellfile.c Wed Nov 06 23:30:04 2019 +0100
+++ b/src/spellfile.c Thu Nov 07 21:00:05 2019 +0100
@@ -260,6 +260,8 @@
260260 * follow; never used in prefix tree */
261261 #define BY_SPECIAL BY_FLAGS2 /* highest special byte value */
262262
263+#define ZERO_FLAG 65009 // used when flag is zero: "0"
264+
263265 /* Flags used in .spl file for soundsalike flags. */
264266 #define SAL_F0LLOWUP 1
265267 #define SAL_COLLAPSE 2
@@ -3182,6 +3184,7 @@
31823184
31833185 /*
31843186 * Get one affix name from "*pp" and advance the pointer.
3187+ * Returns ZERO_FLAG for "0".
31853188 * Returns zero for an error, still advances the pointer then.
31863189 */
31873190 static unsigned
@@ -3197,6 +3200,8 @@
31973200 return 0;
31983201 }
31993202 res = getdigits(pp);
3203+ if (res == 0)
3204+ res = ZERO_FLAG;
32003205 }
32013206 else
32023207 {
@@ -3343,6 +3348,8 @@
33433348 for (p = afflist; *p != NUL; )
33443349 {
33453350 n = getdigits(&p);
3351+ if (n == 0)
3352+ n = ZERO_FLAG;
33463353 if (n == flag)
33473354 return TRUE;
33483355 if (*p != NUL) /* skip over comma */
diff -r 2602ebaedfda -r 4fbfecbb968c src/testdir/test_spell.vim
--- a/src/testdir/test_spell.vim Wed Nov 06 23:30:04 2019 +0100
+++ b/src/testdir/test_spell.vim Thu Nov 07 21:00:05 2019 +0100
@@ -290,9 +290,9 @@
290290 \ ])
291291
292292 call LoadAffAndDic(g:test_data_aff7, g:test_data_dic7)
293- call RunGoodBad("meea1 meea\xE9 bar prebar barmeat prebarmeat leadprebar lead tail leadtail leadmiddletail",
293+ call RunGoodBad("meea1 meezero meea\xE9 bar prebar barmeat prebarmeat leadprebar lead tail leadtail leadmiddletail",
294294 \ "bad: mee meea2 prabar probarmaat middle leadmiddle middletail taillead leadprobar",
295- \ ["bar", "barmeat", "lead", "meea1", "meea\xE9", "prebar", "prebarmeat", "tail"],
295+ \ ["bar", "barmeat", "lead", "meea1", "meea\xE9", "meezero", "prebar", "prebarmeat", "tail"],
296296 \ [
297297 \ ["bad", ["bar", "lead", "tail"]],
298298 \ ["mee", ["meea1", "meea\xE9", "bar"]],
@@ -746,6 +746,9 @@
746746 \"SFX 61003 Y 1",
747747 \"SFX 61003 0 meat .",
748748 \"",
749+ \"SFX 0 Y 1",
750+ \"SFX 0 0 zero .",
751+ \"",
749752 \"SFX 391 Y 1",
750753 \"SFX 391 0 a1 .",
751754 \"",
@@ -757,7 +760,7 @@
757760 \ ]
758761 let g:test_data_dic7 = [
759762 \"1234",
760- \"mee/391,111,9999",
763+ \"mee/0,391,111,9999",
761764 \"bar/17,61003,123",
762765 \"lead/2",
763766 \"tail/123",
diff -r 2602ebaedfda -r 4fbfecbb968c src/version.c
--- a/src/version.c Wed Nov 06 23:30:04 2019 +0100
+++ b/src/version.c Thu Nov 07 21:00:05 2019 +0100
@@ -742,6 +742,8 @@
742742 static int included_patches[] =
743743 { /* Add new patch number below this line */
744744 /**/
745+ 2268,
746+/**/
745747 2267,
746748 /**/
747749 2266,
Show on old repository browser