summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2005-08-30 21:55:26 +0000
committerBram Moolenaar <Bram@vim.org>2005-08-30 21:55:26 +0000
commitda2303d96b0f55d30e9b5b57d3459d5e1ea22ec2 (patch)
tree08f61aa2e9937f30bd141fd6509bc947e1d8a8fa /src
parentac6e65f88da446bc764ff13a23d854fd72ffedcf (diff)
downloadvim-git-da2303d96b0f55d30e9b5b57d3459d5e1ea22ec2.tar.gz
updated for version 7.0139v7.0139
Diffstat (limited to 'src')
-rw-r--r--src/fileio.c5
-rw-r--r--src/gui_mac.c12
-rw-r--r--src/if_ruby.c22
-rw-r--r--src/mbyte.c5
-rw-r--r--src/normal.c12
-rw-r--r--src/option.c2
-rw-r--r--src/os_mac_conv.c19
-rw-r--r--src/os_unix.c11
-rw-r--r--src/proto.h4
-rw-r--r--src/proto/gui_mac.pro1
-rw-r--r--src/proto/os_mac_conv.pro10
-rw-r--r--src/screen.c4
-rw-r--r--src/spell.c163
-rw-r--r--src/testdir/test58.in122
-rw-r--r--src/testdir/test58.ok104
-rw-r--r--src/testdir/test59.in126
-rw-r--r--src/testdir/test59.ok106
-rw-r--r--src/version.h4
18 files changed, 631 insertions, 101 deletions
diff --git a/src/fileio.c b/src/fileio.c
index a34048cef..d49d87b69 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -1515,8 +1515,6 @@ retry:
# ifdef MACOS_X
if (fio_flags & FIO_MACROMAN)
{
- extern int macroman2enc __ARGS((char_u *ptr, long *sizep, long
- real_size));
/*
* Conversion from Apple MacRoman char encoding to UTF-8 or
* latin1. This is in os_mac_conv.c.
@@ -4815,9 +4813,6 @@ buf_write_bytes(ip)
*/
char_u *from;
size_t fromlen;
- extern int enc2macroman __ARGS((char_u *from, size_t fromlen,
- char_u *to, int *tolenp, int maxtolen, char_u *rest,
- int *restlenp));
if (ip->bw_restlen > 0)
{
diff --git a/src/gui_mac.c b/src/gui_mac.c
index f01dc86f3..9253aa101 100644
--- a/src/gui_mac.c
+++ b/src/gui_mac.c
@@ -94,10 +94,6 @@ static EventHandlerUPP mouseWheelHandlerUPP = NULL;
#if defined(USE_CARBONIZED) && defined(FEAT_MBYTE)
# define USE_CARBONKEYHANDLER
static EventHandlerUPP keyEventHandlerUPP = NULL;
-/* Defined in os_mac_conv.c */
-extern char_u *mac_utf16_to_enc __ARGS((UniChar *from, size_t fromLen, size_t *actualLen));
-extern UniChar *mac_enc_to_utf16 __ARGS((char_u *from, size_t fromLen, size_t *actualLen));
-extern CFStringRef mac_enc_to_cfstring __ARGS((char_u *from, size_t fromLen));
#endif
#ifdef MACOS_X
@@ -1618,7 +1614,7 @@ InstallFontPanelHandler()
*/
#define FONT_STYLE_BUFFER_SIZE 32
static void
-GetFontPanelSelection(char_u* outName)
+GetFontPanelSelection(char_u *outName)
{
Str255 buf;
ByteCount fontNameLen = 0;
@@ -1639,12 +1635,12 @@ GetFontPanelSelection(char_u* outName)
* get an unwanted utf-16 name) */
if (ATSUFindFontName(fid, kFontFullName, kFontMacintoshPlatform,
kFontNoScriptCode, kFontNoLanguageCode,
- 255, outName, &fontNameLen, NULL) != noErr)
+ 255, (char *)outName, &fontNameLen, NULL) != noErr)
return;
/* Only encode font size, because style (bold, italic, etc) is
* already part of the font full name */
- vim_snprintf(styleString, FONT_STYLE_BUFFER_SIZE, ":h%d",
+ vim_snprintf((char *)styleString, FONT_STYLE_BUFFER_SIZE, ":h%d",
gFontPanelInfo.size/*,
((gFontPanelInfo.style & bold)!=0 ? ":b" : ""),
((gFontPanelInfo.style & italic)!=0 ? ":i" : ""),
@@ -1655,7 +1651,7 @@ GetFontPanelSelection(char_u* outName)
}
else
{
- *outName = NULL;
+ *outName = NUL;
}
}
#endif
diff --git a/src/if_ruby.c b/src/if_ruby.c
index 112b91e5d..4396b467d 100644
--- a/src/if_ruby.c
+++ b/src/if_ruby.c
@@ -191,7 +191,7 @@ static int (*dll_rb_w32_snprintf)(char*, size_t, const char*, ...);
static HINSTANCE hinstRuby = 0; /* Instance of ruby.dll */
/*
- * Table of name to function pointer of python.
+ * Table of name to function pointer of ruby.
*/
#define RUBY_PROC FARPROC
static struct
@@ -768,6 +768,24 @@ static VALUE window_set_height(VALUE self, VALUE height)
return height;
}
+static VALUE window_width(VALUE self)
+{
+ win_T *win = get_win(self);
+
+ return INT2NUM(win->w_width);
+}
+
+static VALUE window_set_width(VALUE self, VALUE width)
+{
+ win_T *win = get_win(self);
+ win_T *savewin = curwin;
+
+ curwin = win;
+ win_setwidth(NUM2INT(width));
+ curwin = savewin;
+ return width;
+}
+
static VALUE window_cursor(VALUE self)
{
win_T *win = get_win(self);
@@ -860,6 +878,8 @@ static void ruby_vim_init(void)
rb_define_method(cVimWindow, "buffer", window_buffer, 0);
rb_define_method(cVimWindow, "height", window_height, 0);
rb_define_method(cVimWindow, "height=", window_set_height, 1);
+ rb_define_method(cVimWindow, "width", window_width, 0);
+ rb_define_method(cVimWindow, "width=", window_set_width, 1);
rb_define_method(cVimWindow, "cursor", window_cursor, 0);
rb_define_method(cVimWindow, "cursor=", window_set_cursor, 1);
diff --git a/src/mbyte.c b/src/mbyte.c
index d446a5b41..bf86b5e10 100644
--- a/src/mbyte.c
+++ b/src/mbyte.c
@@ -5788,11 +5788,6 @@ convert_input_safe(ptr, len, maxlen, restp, restlenp)
return dlen;
}
-#if defined(MACOS_X)
-/* This is in os_mac_conv.c. */
-extern char_u *mac_string_convert __ARGS((char_u *ptr, int len, int *lenp, int fail_on_error, int from, int to, int *unconvlenp));
-#endif
-
/*
* Convert text "ptr[*lenp]" according to "vcp".
* Returns the result in allocated memory and sets "*lenp".
diff --git a/src/normal.c b/src/normal.c
index ebf400853..e7cfad6e7 100644
--- a/src/normal.c
+++ b/src/normal.c
@@ -4678,6 +4678,18 @@ dozet:
== FAIL)
return;
# endif
+ if (ptr == NULL)
+ {
+ pos_T pos = curwin->w_cursor;
+ int attr;
+
+ /* Find bad word under the cursor. */
+ len = spell_move_to(curwin, FORWARD, TRUE, TRUE, &attr);
+ if (len != 0 && curwin->w_cursor.col <= pos.col)
+ ptr = ml_get_pos(&curwin->w_cursor);
+ curwin->w_cursor = pos;
+ }
+
if (ptr == NULL && (len = find_ident_under_cursor(&ptr,
FIND_IDENT)) == 0)
return;
diff --git a/src/option.c b/src/option.c
index 98c0ad89a..bbf564a50 100644
--- a/src/option.c
+++ b/src/option.c
@@ -2994,7 +2994,7 @@ set_init_1()
kLocaleRegionMask | kLocaleRegionVariantMask,
sizeof buf, buf) == noErr && *buf)
{
- vim_setenv("LANG", buf);
+ vim_setenv((char_u *)"LANG", (char_u *)buf);
# ifdef HAVE_LOCALE_H
setlocale(LC_ALL, "");
# endif
diff --git a/src/os_mac_conv.c b/src/os_mac_conv.c
index c255e736d..fbce5770d 100644
--- a/src/os_mac_conv.c
+++ b/src/os_mac_conv.c
@@ -17,17 +17,6 @@
#include "vim.h"
#ifdef FEAT_MBYTE
-extern char_u *mac_string_convert __ARGS((char_u *ptr, int len, int *lenp, int fail_on_error, int from, int to, int *unconvlenp));
-extern int macroman2enc __ARGS((char_u *ptr, long *sizep, long real_size));
-extern int enc2macroman __ARGS((char_u *from, size_t fromlen, char_u *to, int *tolenp, int maxtolen, char_u *rest, int *restlenp));
-
-extern void mac_conv_init __ARGS((void));
-extern void mac_conv_cleanup __ARGS((void));
-extern char_u *mac_utf16_to_enc __ARGS((UniChar *from, size_t fromLen, size_t *actualLen));
-extern UniChar *mac_enc_to_utf16 __ARGS((char_u *from, size_t fromLen, size_t *actualLen));
-extern CFStringRef mac_enc_to_cfstring __ARGS((char_u *from, size_t fromLen));
-extern char_u *mac_precompose_path __ARGS((char_u *decompPath, size_t decompLen, size_t *precompLen));
-
static char_u *mac_utf16_to_utf8 __ARGS((UniChar *from, size_t fromLen, size_t *actualLen));
static UniChar *mac_utf8_to_utf16 __ARGS((char_u *from, size_t fromLen, size_t *actualLen));
@@ -114,7 +103,7 @@ mac_string_convert(ptr, len, lenp, fail_on_error, from_enc, to_enc, unconvlenp)
if (!CFStringGetBytes(cfstr, convertRange, to, NULL, FALSE, retval, buflen, NULL))
#endif
- if (!CFStringGetCString(cfstr, retval, buflen, to))
+ if (!CFStringGetCString(cfstr, (char *)retval, buflen, to))
{
CFRelease(cfstr);
if (fail_on_error)
@@ -140,14 +129,14 @@ mac_string_convert(ptr, len, lenp, fail_on_error, from_enc, to_enc, unconvlenp)
}
else
{
- if (!CFStringGetCString(cfstr, d, buflen - out, to))
+ if (!CFStringGetCString(cfstr, (char *)d, buflen - out, to))
{
*d++ = '?';
out++;
}
else
{
- i = strlen(d);
+ i = STRLEN(d);
d += i;
out += i;
}
@@ -162,7 +151,7 @@ mac_string_convert(ptr, len, lenp, fail_on_error, from_enc, to_enc, unconvlenp)
}
CFRelease(cfstr);
if (lenp != NULL)
- *lenp = strlen(retval);
+ *lenp = STRLEN(retval);
return retval;
}
diff --git a/src/os_unix.c b/src/os_unix.c
index d567f900f..7d324827f 100644
--- a/src/os_unix.c
+++ b/src/os_unix.c
@@ -173,17 +173,6 @@ static int have_wildcard __ARGS((int, char_u **));
static int have_dollars __ARGS((int, char_u **));
#endif
-#ifndef NO_EXPANDPATH
-# if defined(MACOS_X) && defined(FEAT_MBYTE)
-extern char_u *mac_precompose_path __ARGS((char_u *decompPath, size_t decompLen, size_t *precompLen));
-# endif
-#endif
-
-#if defined(MACOS_X) && defined(FEAT_MBYTE)
-extern void mac_conv_init __ARGS((void));
-extern void mac_conv_cleanup __ARGS((void));
-#endif
-
#ifndef __EMX__
static int save_patterns __ARGS((int num_pat, char_u **pat, int *num_file, char_u ***file));
#endif
diff --git a/src/proto.h b/src/proto.h
index 4c0db37a1..611657863 100644
--- a/src/proto.h
+++ b/src/proto.h
@@ -261,6 +261,10 @@ extern char *vim_SelFile __ARGS((Widget toplevel, char *prompt, char *init_path,
# include "if_perlsfio.pro"
#endif
+#if defined(FEAT_MBYTE) && defined(MACOS_X)
+# include "os_mac_conv.pro"
+#endif
+
#ifdef __BORLANDC__
# define _PROTO_H
#endif
diff --git a/src/proto/gui_mac.pro b/src/proto/gui_mac.pro
index 933fe4d38..c640351b8 100644
--- a/src/proto/gui_mac.pro
+++ b/src/proto/gui_mac.pro
@@ -47,6 +47,7 @@ void gui_mch_free_font __ARGS((GuiFont font));
guicolor_T gui_mch_get_color __ARGS((char_u *name));
void gui_mch_set_fg_color __ARGS((guicolor_T color));
void gui_mch_set_bg_color __ARGS((guicolor_T color));
+void gui_mch_set_sp_color __ARGS((guicolor_T color));
void gui_mch_draw_string __ARGS((int row, int col, char_u *s, int len, int flags));
int gui_mch_haskey __ARGS((char_u *name));
void gui_mch_beep __ARGS((void));
diff --git a/src/proto/os_mac_conv.pro b/src/proto/os_mac_conv.pro
new file mode 100644
index 000000000..1ab9d28f9
--- /dev/null
+++ b/src/proto/os_mac_conv.pro
@@ -0,0 +1,10 @@
+extern char_u *mac_string_convert __ARGS((char_u *ptr, int len, int *lenp, int fail_on_error, int from, int to, int *unconvlenp));
+extern int macroman2enc __ARGS((char_u *ptr, long *sizep, long real_size));
+extern int enc2macroman __ARGS((char_u *from, size_t fromlen, char_u *to, int *tolenp, int maxtolen, char_u *rest, int *restlenp));
+
+extern void mac_conv_init __ARGS((void));
+extern void mac_conv_cleanup __ARGS((void));
+extern char_u *mac_utf16_to_enc __ARGS((UniChar *from, size_t fromLen, size_t *actualLen));
+extern UniChar *mac_enc_to_utf16 __ARGS((char_u *from, size_t fromLen, size_t *actualLen));
+extern CFStringRef mac_enc_to_cfstring __ARGS((char_u *from, size_t fromLen));
+extern char_u *mac_precompose_path __ARGS((char_u *decompPath, size_t decompLen, size_t *precompLen));
diff --git a/src/screen.c b/src/screen.c
index ba345ae47..2c39ac73a 100644
--- a/src/screen.c
+++ b/src/screen.c
@@ -2939,6 +2939,10 @@ win_line(wp, lnum, startrow, endrow)
word_end = wp->w_cursor.col + len + 1;
wp->w_cursor = pos;
+
+ /* Need to restart syntax highlighting for this line. */
+ if (has_syntax)
+ syntax_start(wp, lnum);
}
#endif
}
diff --git a/src/spell.c b/src/spell.c
index 2b04bf8b3..56c891d82 100644
--- a/src/spell.c
+++ b/src/spell.c
@@ -375,7 +375,7 @@ struct slang_S
char_u *sl_midword; /* MIDWORD string or NULL */
int sl_compmax; /* COMPOUNDMAX (default: MAXWLEN) */
- int sl_compminlen; /* COMPOUNDMIN (default: MAXWLEN) */
+ int sl_compminlen; /* COMPOUNDMIN (default: 0) */
int sl_compsylmax; /* COMPOUNDSYLMAX (default: MAXWLEN) */
regprog_T *sl_compprog; /* COMPOUNDFLAGS turned into a regexp progrm
* (NULL when no compounding) */
@@ -1299,7 +1299,7 @@ find_word(mip, mode)
/* For multi-byte chars check character length against
* COMPOUNDMIN. */
if (has_mbyte
- && slang->sl_compminlen < MAXWLEN
+ && slang->sl_compminlen > 0
&& mb_charlen_len(mip->mi_word + mip->mi_compoff,
wlen - mip->mi_compoff) < slang->sl_compminlen)
continue;
@@ -1388,6 +1388,8 @@ find_word(mip, mode)
{
int save_result = mip->mi_result;
char_u *save_end = mip->mi_end;
+ langp_T *save_lp = mip->mi_lp;
+ int lpi;
/* Check that a valid word follows. If there is one and we
* are compounding, it will set "mi_result", thus we are
@@ -1417,25 +1419,43 @@ find_word(mip, mode)
#endif
c = mip->mi_compoff;
++mip->mi_complen;
- find_word(mip, FIND_COMPOUND);
- /* When NOBREAK any word that matches is OK. Otherwise we
- * need to find the longest match, thus try with keep-case and
- * prefix too. */
- if (!slang->sl_nobreak || mip->mi_result == SP_BAD)
+ /* For NOBREAK we need to try all NOBREAK languages, at least
+ * to find the ".add" file(s). */
+ for (lpi = 0; lpi < mip->mi_buf->b_langp.ga_len; ++lpi)
{
- /* Find following word in keep-case tree. */
- mip->mi_compoff = wlen;
- find_word(mip, FIND_KEEPCOMPOUND);
+ if (slang->sl_nobreak)
+ {
+ mip->mi_lp = LANGP_ENTRY(mip->mi_buf->b_langp, lpi);
+ if (mip->mi_lp->lp_slang->sl_fidxs == NULL
+ || !mip->mi_lp->lp_slang->sl_nobreak)
+ continue;
+ }
+
+ find_word(mip, FIND_COMPOUND);
+ /* When NOBREAK any word that matches is OK. Otherwise we
+ * need to find the longest match, thus try with keep-case
+ * and prefix too. */
if (!slang->sl_nobreak || mip->mi_result == SP_BAD)
{
- /* Check for following word with prefix. */
- mip->mi_compoff = c;
- find_prefix(mip, FIND_COMPOUND);
+ /* Find following word in keep-case tree. */
+ mip->mi_compoff = wlen;
+ find_word(mip, FIND_KEEPCOMPOUND);
+
+ if (!slang->sl_nobreak || mip->mi_result == SP_BAD)
+ {
+ /* Check for following word with prefix. */
+ mip->mi_compoff = c;
+ find_prefix(mip, FIND_COMPOUND);
+ }
}
+
+ if (!slang->sl_nobreak)
+ break;
}
--mip->mi_complen;
+ mip->mi_lp = save_lp;
if (slang->sl_nobreak)
{
@@ -2037,6 +2057,13 @@ spell_cat_line(buf, line, maxlen)
}
}
+typedef struct spelload_S
+{
+ char_u sl_lang[MAXWLEN + 1]; /* language name */
+ slang_T *sl_slang; /* resulting slang_T struct */
+ int sl_nobreak; /* NOBREAK language found */
+} spelload_T;
+
/*
* Load word list(s) for "lang" from Vim spell file(s).
* "lang" must be the language without the region: e.g., "en".
@@ -2047,35 +2074,37 @@ spell_load_lang(lang)
{
char_u fname_enc[85];
int r;
- char_u langcp[MAXWLEN + 1];
+ spelload_T sl;
/* Copy the language name to pass it to spell_load_cb() as a cookie.
* It's truncated when an error is detected. */
- STRCPY(langcp, lang);
+ STRCPY(sl.sl_lang, lang);
+ sl.sl_slang = NULL;
+ sl.sl_nobreak = FALSE;
/*
* Find the first spell file for "lang" in 'runtimepath' and load it.
*/
vim_snprintf((char *)fname_enc, sizeof(fname_enc) - 5,
"spell/%s.%s.spl", lang, spell_enc());
- r = do_in_runtimepath(fname_enc, FALSE, spell_load_cb, &langcp);
+ r = do_in_runtimepath(fname_enc, FALSE, spell_load_cb, &sl);
- if (r == FAIL && *langcp != NUL)
+ if (r == FAIL && *sl.sl_lang != NUL)
{
/* Try loading the ASCII version. */
vim_snprintf((char *)fname_enc, sizeof(fname_enc) - 5,
"spell/%s.ascii.spl", lang);
- r = do_in_runtimepath(fname_enc, FALSE, spell_load_cb, &langcp);
+ r = do_in_runtimepath(fname_enc, FALSE, spell_load_cb, &sl);
}
if (r == FAIL)
smsg((char_u *)_("Warning: Cannot find word list \"%s.%s.spl\" or \"%s.ascii.spl\""),
lang, spell_enc(), lang);
- else if (*langcp != NUL)
+ else if (sl.sl_slang != NULL)
{
- /* Load all the additions. */
+ /* At least one file was loaded, now load all the additions. */
STRCPY(fname_enc + STRLEN(fname_enc) - 3, "add.spl");
- do_in_runtimepath(fname_enc, TRUE, spell_load_cb, &langcp);
+ do_in_runtimepath(fname_enc, TRUE, spell_load_cb, &sl);
}
}
@@ -2122,7 +2151,6 @@ slang_alloc(lang)
lp->sl_name = vim_strsave(lang);
ga_init2(&lp->sl_rep, sizeof(fromto_T), 10);
lp->sl_compmax = MAXWLEN;
- lp->sl_compminlen = MAXWLEN;
lp->sl_compsylmax = MAXWLEN;
}
return lp;
@@ -2237,7 +2265,7 @@ slang_clear(lp)
#endif
lp->sl_compmax = MAXWLEN;
- lp->sl_compminlen = MAXWLEN;
+ lp->sl_compminlen = 0;
lp->sl_compsylmax = MAXWLEN;
lp->sl_regions[0] = NUL;
}
@@ -2249,9 +2277,23 @@ slang_clear(lp)
static void
spell_load_cb(fname, cookie)
char_u *fname;
- void *cookie; /* points to the language name */
+ void *cookie;
{
- (void)spell_load_file(fname, (char_u *)cookie, NULL, FALSE);
+ spelload_T *slp = (spelload_T *)cookie;
+ slang_T *slang;
+
+ slang = spell_load_file(fname, slp->sl_lang, NULL, FALSE);
+ if (slang != NULL)
+ {
+ /* When a previously loaded file has NOBREAK also use it for the
+ * ".add" files. */
+ if (slp->sl_nobreak && slang->sl_add)
+ slang->sl_nobreak = TRUE;
+ else if (slang->sl_nobreak)
+ slp->sl_nobreak = TRUE;
+
+ slp->sl_slang = slang;
+ }
}
/*
@@ -2941,7 +2983,7 @@ read_compound(fd, slang, len)
--todo;
c = getc(fd); /* <compminlen> */
if (c < 1)
- c = MAXWLEN;
+ c = 0;
slang->sl_compminlen = c;
--todo;
@@ -3508,6 +3550,7 @@ did_set_spelllang(buf)
char_u *spf;
char_u *use_region = NULL;
int dont_use_region = FALSE;
+ int nobreak = FALSE;
ga_init2(&ga, sizeof(langp_T), 2);
clear_midword(buf);
@@ -3624,6 +3667,8 @@ did_set_spelllang(buf)
LANGP_ENTRY(ga, ga.ga_len)->lp_region = region_mask;
++ga.ga_len;
use_midword(lp, buf);
+ if (lp->sl_nobreak)
+ nobreak = TRUE;
}
}
}
@@ -3678,6 +3723,11 @@ did_set_spelllang(buf)
*p = NUL; /* truncate at ".encoding.add" */
}
lp = spell_load_file(spf_name, lang, NULL, TRUE);
+
+ /* If one of the languages has NOBREAK we assume the addition
+ * files also have this. */
+ if (lp != NULL && nobreak)
+ lp->sl_nobreak = TRUE;
}
if (lp != NULL && ga_grow(&ga, 1) == OK)
{
@@ -5229,8 +5279,6 @@ process_compflags(spin, aff, compflags)
STRCPY(p, spin->si_compflags);
STRCAT(p, "/");
}
- else
- *p = NUL;
spin->si_compflags = p;
tp = p + STRLEN(p);
@@ -7703,37 +7751,55 @@ init_spellfile()
char_u *fname;
char_u *rtp;
char_u *lend;
+ int aspath = FALSE;
+ char_u *lstart = curbuf->b_p_spl;
if (*curbuf->b_p_spl != NUL && curbuf->b_langp.ga_len > 0)
{
- /* Find the end of the language name. Exclude the region. */
+ /* Find the end of the language name. Exclude the region. If there
+ * is a path separator remember the start of the tail. */
for (lend = curbuf->b_p_spl; *lend != NUL
&& vim_strchr((char_u *)",._", *lend) == NULL; ++lend)
- ;
+ if (vim_ispathsep(*lend))
+ {
+ aspath = TRUE;
+ lstart = lend + 1;
+ }
/* Loop over all entries in 'runtimepath'. Use the first one where we
* are allowed to write. */
rtp = p_rtp;
while (*rtp != NUL)
{
- /* Copy the path from 'runtimepath' to buf[]. */
- copy_option_part(&rtp, buf, MAXPATHL, ",");
+ if (aspath)
+ /* Use directory of an entry with path, e.g., for
+ * "/dir/lg.utf-8.spl" use "/dir". */
+ vim_strncpy(buf, curbuf->b_p_spl, lstart - curbuf->b_p_spl - 1);
+ else
+ /* Copy the path from 'runtimepath' to buf[]. */
+ copy_option_part(&rtp, buf, MAXPATHL, ",");
if (filewritable(buf) == 2)
{
/* Use the first language name from 'spelllang' and the
* encoding used in the first loaded .spl file. */
- fname = LANGP_ENTRY(curbuf->b_langp, 0)->lp_slang->sl_fname;
- if (fname == NULL)
- break;
+ if (aspath)
+ vim_strncpy(buf, curbuf->b_p_spl, lend - curbuf->b_p_spl);
+ else
+ {
+ l = STRLEN(buf);
+ vim_snprintf((char *)buf + l, MAXPATHL - l,
+ "/spell/%.*s", (int)(lend - lstart), lstart);
+ }
l = STRLEN(buf);
- vim_snprintf((char *)buf + l, MAXPATHL - l,
- "/spell/%.*s.%s.add",
- (int)(lend - curbuf->b_p_spl), curbuf->b_p_spl,
- strstr((char *)gettail(fname), ".ascii.") != NULL
- ? (char_u *)"ascii" : spell_enc());
+ fname = LANGP_ENTRY(curbuf->b_langp, 0)->lp_slang->sl_fname;
+ vim_snprintf((char *)buf + l, MAXPATHL - l, ".%s.add",
+ fname != NULL
+ && strstr((char *)gettail(fname), ".ascii.") != NULL
+ ? (char_u *)"ascii" : spell_enc());
set_option_value((char_u *)"spellfile", 0L, buf, OPT_LOCAL);
break;
}
+ aspath = FALSE;
}
}
}
@@ -9293,7 +9359,7 @@ suggest_try_change(su)
/* For multi-byte chars check character length against
* COMPOUNDMIN. */
if (has_mbyte
- && slang->sl_compminlen < MAXWLEN
+ && slang->sl_compminlen > 0
&& mb_charlen(tword + sp->ts_splitoff)
< slang->sl_compminlen)
break;
@@ -9430,7 +9496,7 @@ suggest_try_change(su)
>= slang->sl_compminlen
#ifdef FEAT_MBYTE
&& (!has_mbyte
- || slang->sl_compminlen == MAXWLEN
+ || slang->sl_compminlen == 0
|| mb_charlen(tword + sp->ts_splitoff)
>= slang->sl_compminlen)
#endif
@@ -9470,7 +9536,12 @@ suggest_try_change(su)
if (!try_compound && !fword_ends)
{
/* If we're going to split need to check that the
- * words so far are valid for compounding. */
+ * words so far are valid for compounding. If there
+ * is only one word it must not have the NEEDCOMPOUND
+ * flag. */
+ if (sp->ts_complen == sp->ts_compsplit
+ && (flags & WF_NEEDCOMP))
+ break;
p = preword;
while (*skiptowhite(p) != NUL)
p = skipwhite(skiptowhite(p));
@@ -9576,7 +9647,11 @@ suggest_try_change(su)
case STATE_ENDNUL:
/* Past the NUL bytes in the node. */
su->su_badflags = sp->ts_save_badflags;
- if (fword[sp->ts_fidx] == NUL)
+ if (fword[sp->ts_fidx] == NUL
+#ifdef FEAT_MBYTE
+ && sp->ts_tcharlen == 0
+#endif
+ )
{
/* The badword ends, can't use the bytes in this node. */
sp->ts_state = STATE_DEL;
diff --git a/src/testdir/test58.in b/src/testdir/test58.in
index 8bb58bfee..b3902f13c 100644
--- a/src/testdir/test58.in
+++ b/src/testdir/test58.in
@@ -93,6 +93,9 @@ gg:/^addstart/+1,/^addend/-1w! Xtest.latin1.add
:" Compound words
:call TestOne('3', '3')
:call TestOne('4', '4')
+:call TestOne('5', '5')
+:call TestOne('6', '6')
+:call TestOne('7', '7')
:"
gg:/^test output:/,$wq! test.out
ENDTEST
@@ -474,4 +477,123 @@ bad: wordutilize pro borkborkborkborkborkbork tomatotomatotomato
startwordwordwordwordend borkpreborkpreborkbork
badend
+Test affix flags with two characters
+
+5affstart
+SET ISO8859-1
+
+FLAG long
+
+NEEDAFFIX !!
+
+COMPOUNDFLAGS ssmm*ee
+
+NEEDCOMPOUND xx
+
+SFX 13 Y 1
+SFX 13 0 bork .
+
+SFX a1 Y 1
+SFX a1 0 a1 .
+
+SFX aé Y 1
+SFX aé 0 aé .
+
+PFX zz Y 1
+PFX zz 0 pre .
+5affend
+
+5dicstart
+1234
+foo/a1aé!!
+bar/zz13ee
+start/ss
+end/ee
+middle/mmxx
+5dicend
+
+5good: fooa1 fooaé bar prebar barbork prebarbork startprebar
+ start end startend startmiddleend
+bad: foo fooa2 prabar probarbirk middle startmiddle middleend endstart
+ startprobar
+badend
+
+6affstart
+SET ISO8859-1
+
+FLAG caplong
+
+NEEDAFFIX A!
+
+COMPOUNDFLAGS sMm*Ee
+
+NEEDCOMPOUND Xx
+
+SFX N3 Y 1
+SFX N3 0 bork .
+
+SFX A1 Y 1
+SFX A1 0 a1 .
+
+SFX Aé Y 1
+SFX Aé 0 aé .
+
+PFX Zz Y 1
+PFX Zz 0 pre .
+6affend
+
+6dicstart
+1234
+mee/A1AéA!
+bar/ZzN3Ee
+lead/s
+end/Ee
+middle/MmXx
+6dicend
+
+6good: meea1 meeaé bar prebar barbork prebarbork leadprebar
+ lead end leadend leadmiddleend
+bad: mee meea2 prabar probarbirk middle leadmiddle middleend endlead
+ leadprobar
+badend
+
+7affstart
+SET ISO8859-1
+
+FLAG num
+
+NEEDAFFIX 9999
+
+COMPOUNDFLAGS 2,77*123
+
+NEEDCOMPOUND 1
+
+SFX 61003 Y 1
+SFX 61003 0 meat .
+
+SFX 391 Y 1
+SFX 391 0 a1 .
+
+SFX 111 Y 1
+SFX 111 0 aé .
+
+PFX 17 Y 1
+PFX 17 0 pre .
+7affend
+
+7dicstart
+1234
+mee/391,111,9999
+bar/17,61003,123
+lead/2
+tail/123
+middle/77,1
+7dicend
+
+7good: meea1 meeaé bar prebar barmeat prebarmeat leadprebar
+ lead tail leadtail leadmiddletail
+bad: mee meea2 prabar probarmaat middle leadmiddle middletail taillead
+ leadprobar
+badend
+
test output:
diff --git a/src/testdir/test58.ok b/src/testdir/test58.ok
index 67f1f9cac..9fba6bc0a 100644
--- a/src/testdir/test58.ok
+++ b/src/testdir/test58.ok
@@ -105,19 +105,19 @@ la
foomï
['foo mï', 'foo', 'foofoo']
barmï
-['bar mï', 'barfoo', 'barbar']
+['barfoo', 'barbar', 'mï']
mïfoo
['mï foo', 'foo', 'foofoo']
mïbar
['foobar', 'barbar', 'mï']
mïmï
-['mï mï', 'mï', 'la mï']
+['mï mï', 'mï']
lala
-['la mï']
+[]
mïla
['mï', 'mï mï']
lamï
-['la mï', 'mï', 'mï mï']
+['mï', 'mï mï']
foola
['foo', 'foobar', 'foofoo']
labar
@@ -160,3 +160,99 @@ startwordwordwordwordend
['startwordwordwordword end', 'startwordwordwordword', 'start wordwordwordword end']
borkpreborkpreborkbork
['borkpreborkprebork bork', 'borkprebork preborkbork', 'bork preborkpreborkbork']
+
+test 5-5
+# file: Xtest.latin1.spl
+bar
+barbork
+end
+fooa1
+fooaé
+prebar
+prebarbork
+start
+-------
+bad
+['bar', 'end', 'fooa1']
+foo
+['fooa1', 'fooaé', 'bar']
+fooa2
+['fooa1', 'fooaé', 'bar']
+prabar
+['prebar', 'bar', 'bar bar']
+probarbirk
+['prebarbork']
+middle
+[]
+startmiddle
+['startmiddleend']
+middleend
+[]
+endstart
+['end start', 'start']
+startprobar
+['startprebar', 'start prebar', 'startbar']
+
+test 6-6
+# file: Xtest.latin1.spl
+bar
+barbork
+end
+lead
+meea1
+meeaé
+prebar
+prebarbork
+-------
+bad
+['bar', 'end', 'lead']
+mee
+['meea1', 'meeaé', 'bar']
+meea2
+['meea1', 'meeaé', 'lead']
+prabar
+['prebar', 'leadbar', 'bar']
+probarbirk
+['prebarbork']
+middle
+[]
+leadmiddle
+['leadmiddleend']
+middleend
+[]
+endlead
+['end lead', 'lead', 'end end']
+leadprobar
+['leadprebar', 'lead prebar', 'leadbar']
+
+test 7-7
+# file: Xtest.latin1.spl
+bar
+barmeat
+lead
+meea1
+meeaé
+prebar
+prebarmeat
+tail
+-------
+bad
+['bar', 'lead', 'tail']
+mee
+['meea1', 'meeaé', 'bar']
+meea2
+['meea1', 'meeaé', 'lead']
+prabar
+['prebar', 'leadbar', 'bar']
+probarmaat
+['prebarmeat']
+middle
+[]
+leadmiddle
+[]
+middletail
+[]
+taillead
+['tail lead', 'tail']
+leadprobar
+['leadprebar', 'lead prebar', 'leadbar']
diff --git a/src/testdir/test59.in b/src/testdir/test59.in
index aab48aeea..a2dcc8951 100644
--- a/src/testdir/test59.in
+++ b/src/testdir/test59.in
@@ -97,6 +97,9 @@ gg:/^addstart/+1,/^addend/-1w! Xtest.utf-8.add
:" Compound words
:call TestOne('3', '3')
:call TestOne('4', '4')
+:call TestOne('5', '5')
+:call TestOne('6', '6')
+:call TestOne('7', '7')
:"
gg:/^test output:/,$wq! test.out
ENDTEST
@@ -478,4 +481,127 @@ badend
test2:
elequint test elekwint test elekwent asdf
+Test affix flags with two characters
+
+5affstart
+SET ISO8859-1
+
+FLAG long
+
+NEEDAFFIX !!
+
+COMPOUNDFLAGS ssmm*ee
+
+NEEDCOMPOUND xx
+
+SFX 13 Y 1
+SFX 13 0 bork .
+
+SFX a1 Y 1
+SFX a1 0 a1 .
+
+SFX aé Y 1
+SFX aé 0 aé .
+
+PFX zz Y 1
+PFX zz 0 pre .
+5affend
+
+5dicstart
+1234
+foo/a1aé!!
+bar/zz13ee
+start/ss
+end/ee
+middle/mmxx
+5dicend
+
+5good: fooa1 fooaé bar prebar barbork prebarbork startprebar
+ start end startend startmiddleend
+bad: foo fooa2 prabar probarbirk middle startmiddle middleend endstart
+ startprobar
+badend
+
+6affstart
+SET ISO8859-1
+
+FLAG caplong
+
+NEEDAFFIX A!
+
+COMPOUNDFLAGS sMm*Ee
+
+NEEDCOMPOUND Xx
+
+SFX N3 Y 1
+SFX N3 0 bork .
+
+SFX A1 Y 1
+SFX A1 0 a1 .
+
+SFX Aé Y 1
+SFX Aé 0 aé .
+
+PFX Zz Y 1
+PFX Zz 0 pre .
+6affend
+
+6dicstart
+1234
+mee/A1AéA!
+bar/ZzN3Ee
+lead/s
+end/Ee
+middle/MmXx
+6dicend
+
+6good: meea1 meeaé bar prebar barbork prebarbork leadprebar
+ lead end leadend leadmiddleend
+bad: mee meea2 prabar probarbirk middle leadmiddle middleend endlead
+ leadprobar
+badend
+
+7affstart
+SET ISO8859-1
+
+FOL àáâãäåæçèéêëìíîïðñòóôõöøùúûüýþßÿ
+LOW àáâãäåæçèéêëìíîïðñòóôõöøùúûüýþßÿ
+UPP ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßÿ
+
+FLAG num
+
+NEEDAFFIX 9999
+
+COMPOUNDFLAGS 2,77*123
+
+NEEDCOMPOUND 1
+
+SFX 61003 Y 1
+SFX 61003 0 meat .
+
+SFX 391 Y 1
+SFX 391 0 a1 .
+
+SFX 111 Y 1
+SFX 111 0 aé .
+
+PFX 17 Y 1
+PFX 17 0 pre .
+7affend
+
+7dicstart
+1234
+mee/391,111,9999
+bar/17,61003,123
+lead/2
+tail/123
+middle/77,1
+7dicend
+
+7good: meea1 meeaé bar prebar barmeat prebarmeat leadprebar
+ lead tail leadtail leadmiddletail
+bad: mee meea2 prabar probarmaat middle leadmiddle middletail taillead
+ leadprobar
+badend
+
test output:
diff --git a/src/testdir/test59.ok b/src/testdir/test59.ok
index e09eaaceb..c37ecb862 100644
--- a/src/testdir/test59.ok
+++ b/src/testdir/test59.ok
@@ -101,23 +101,23 @@ bad
bar
['foobar', 'foo', 'mï']
la
-['foo', 'mï']
+['mï', 'foo']
foomï
['foo mï', 'foo', 'foofoo']
barmï
-['bar mï', 'barfoo', 'barbar']
+['barfoo', 'barbar', 'mï']
mïfoo
['mï foo', 'foo', 'foofoo']
mïbar
['foobar', 'barbar', 'mï']
mïmï
-['mï mï', 'mï', 'la mï']
+['mï mï', 'mï']
lala
[]
mïla
-['mï']
+['mï', 'mï mï']
lamï
-['la mï', 'mï', 'mï mï']
+['mï', 'mï mï']
foola
['foo', 'foobar', 'foofoo']
labar
@@ -160,3 +160,99 @@ startwordwordwordwordend
['startwordwordwordword end', 'startwordwordwordword', 'start wordwordwordword end']
borkpreborkpreborkbork
['borkpreborkprebork bork', 'borkprebork preborkbork', 'bork preborkpreborkbork']
+
+test 5-5
+# file: Xtest.utf-8.spl
+bar
+barbork
+end
+fooa1
+fooaé
+prebar
+prebarbork
+start
+-------
+bad
+['bar', 'end', 'fooa1']
+foo
+['fooa1', 'fooaé', 'bar']
+fooa2
+['fooa1', 'fooaé', 'bar']
+prabar
+['prebar', 'bar', 'bar bar']
+probarbirk
+['prebarbork']
+middle
+[]
+startmiddle
+['startmiddleend']
+middleend
+[]
+endstart
+['end start', 'start']
+startprobar
+['startprebar', 'start prebar', 'startbar']
+
+test 6-6
+# file: Xtest.utf-8.spl
+bar
+barbork
+end
+lead
+meea1
+meeaé
+prebar
+prebarbork
+-------
+bad
+['bar', 'end', 'lead']
+mee
+['meea1', 'meeaé', 'bar']
+meea2
+['meea1', 'meeaé', 'lead']
+prabar
+['prebar', 'leadbar', 'bar']
+probarbirk
+['prebarbork']
+middle
+[]
+leadmiddle
+['leadmiddleend']
+middleend
+[]
+endlead
+['end lead', 'lead', 'end end']
+leadprobar
+['leadprebar', 'lead prebar', 'leadbar']
+
+test 7-7
+# file: Xtest.utf-8.spl
+bar
+barmeat
+lead
+meea1
+meeaé
+prebar
+prebarmeat
+tail
+-------
+bad
+['bar', 'lead', 'tail']
+mee
+['meea1', 'meeaé', 'bar']
+meea2
+['meea1', 'meeaé', 'lead']
+prabar
+['prebar', 'leadbar', 'bar']
+probarmaat
+['prebarmeat']
+middle
+[]
+leadmiddle
+[]
+middletail
+[]
+taillead
+['tail lead', 'tail']
+leadprobar
+['leadprebar', 'lead prebar', 'leadbar']
diff --git a/src/version.h b/src/version.h
index 2317c87a2..2ea46ab9b 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 Aug 29)"
-#define VIM_VERSION_LONG_DATE "VIM - Vi IMproved 7.0aa ALPHA (2005 Aug 29, compiled "
+#define VIM_VERSION_LONG "VIM - Vi IMproved 7.0aa ALPHA (2005 Aug 30)"
+#define VIM_VERSION_LONG_DATE "VIM - Vi IMproved 7.0aa ALPHA (2005 Aug 30, compiled "