mirror of
https://github.com/vim/vim.git
synced 2025-09-27 04:14:06 -04:00
updated for version 7.0109
This commit is contained in:
29
src/spell.c
29
src/spell.c
@@ -2545,6 +2545,7 @@ did_set_spelllang(buf)
|
||||
garray_T ga;
|
||||
char_u *splp;
|
||||
char_u *region;
|
||||
char_u region_cp[3];
|
||||
int filename;
|
||||
int region_mask;
|
||||
slang_T *lp;
|
||||
@@ -2577,6 +2578,19 @@ did_set_spelllang(buf)
|
||||
{
|
||||
filename = TRUE;
|
||||
|
||||
/* Locate a region and remove it from the file name. */
|
||||
p = vim_strchr(gettail(lang), '_');
|
||||
if (p != NULL && ASCII_ISALPHA(p[1]) && ASCII_ISALPHA(p[2])
|
||||
&& !ASCII_ISALPHA(p[3]))
|
||||
{
|
||||
vim_strncpy(region_cp, p + 1, 2);
|
||||
mch_memmove(p, p + 3, len - (p - lang) - 2);
|
||||
len -= 3;
|
||||
region = region_cp;
|
||||
}
|
||||
else
|
||||
dont_use_region = TRUE;
|
||||
|
||||
/* Check if we loaded this language before. */
|
||||
for (lp = first_lang; lp != NULL; lp = lp->sl_next)
|
||||
if (fullpathcmp(lang, lp->sl_fname, FALSE) == FPC_SAME)
|
||||
@@ -2590,12 +2604,6 @@ did_set_spelllang(buf)
|
||||
region = lang + len - 2;
|
||||
len -= 3;
|
||||
lang[len] = NUL;
|
||||
|
||||
/* If the region differs from what was used before then don't
|
||||
* use it for 'spellfile'. */
|
||||
if (use_region != NULL && STRCMP(region, use_region) != 0)
|
||||
dont_use_region = TRUE;
|
||||
use_region = region;
|
||||
}
|
||||
else
|
||||
dont_use_region = TRUE;
|
||||
@@ -2606,6 +2614,15 @@ did_set_spelllang(buf)
|
||||
break;
|
||||
}
|
||||
|
||||
if (region != NULL)
|
||||
{
|
||||
/* If the region differs from what was used before then don't
|
||||
* use it for 'spellfile'. */
|
||||
if (use_region != NULL && STRCMP(region, use_region) != 0)
|
||||
dont_use_region = TRUE;
|
||||
use_region = region;
|
||||
}
|
||||
|
||||
/* If not found try loading the language now. */
|
||||
if (lp == NULL)
|
||||
{
|
||||
|
Reference in New Issue
Block a user