mirror of
https://github.com/vim/vim
synced 2025-03-16 14:57:52 +01:00
updated for version 7.0134
This commit is contained in:
parent
d52d9741ee
commit
e52325c254
3 changed files with 142 additions and 16 deletions
63
runtime/spell/am/main.aap
Normal file
63
runtime/spell/am/main.aap
Normal file
|
@ -0,0 +1,63 @@
|
|||
# Aap recipe for Amharic 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 = am_ET.aff am_ET.dic
|
||||
|
||||
all: $SPELLDIR/am.utf-8.spl ../README_am.txt
|
||||
|
||||
$SPELLDIR/am.utf-8.spl : $FILES
|
||||
:sys env LANG=am_ET.UTF-8 $VIM -u NONE -e -c "mkspell! $SPELLDIR/am am_ET" -c q
|
||||
|
||||
../README_am.txt: README_am.txt
|
||||
:copy $source $target
|
||||
|
||||
#
|
||||
# Fetching the files from Hunspell.
|
||||
#
|
||||
HTTPDIR = http://hunspell.sourceforge.net
|
||||
TARNAME = am-demo.tar.gz
|
||||
:attr {fetch = $HTTPDIR/%file%} $TARNAME
|
||||
|
||||
# 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.
|
||||
am_ET.aff am_ET.dic: {buildcheck=}
|
||||
:assertpkg tar gzip
|
||||
:fetch $TARNAME
|
||||
:sys gzip -d -c $TARNAME | tar xf -
|
||||
:move am/am.aff am_ET.aff
|
||||
:move am/am.dic am_ET.dic
|
||||
:move am/README README_am.txt
|
||||
:delete {recursive} am
|
||||
:delete $TARNAME
|
||||
@if not os.path.exists('am_ET.orig.aff'):
|
||||
:copy am_ET.aff am_ET.orig.aff
|
||||
@if not os.path.exists('am_ET.orig.dic'):
|
||||
:copy am_ET.dic am_ET.orig.dic
|
||||
@if os.path.exists('am_ET.diff'):
|
||||
:sys patch <am_ET.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 -a -C 1 am_ET.orig.aff am_ET.aff >am_ET.diff
|
||||
:sys {force} diff -a -C 1 am_ET.orig.dic am_ET.dic >>am_ET.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 implemented yet.
|
||||
|
||||
|
||||
# vim: set sts=4 sw=4 :
|
|
@ -4,7 +4,7 @@
|
|||
# aap generate all the .spl files
|
||||
# aap diff create all the diff files
|
||||
|
||||
LANG = af bg ca cs da de el en eo fr fo gl he hr it nl ny pl sk yi hu
|
||||
LANG = af am bg ca cs da de el en eo fr fo gl he hr it nl ny pl sk yi hu
|
||||
|
||||
# "hu" is at the end, because it takes very long.
|
||||
#
|
||||
|
|
93
src/spell.c
93
src/spell.c
|
@ -250,9 +250,9 @@
|
|||
Some places assume a word length fits in a
|
||||
byte, thus it can't be above 255. */
|
||||
|
||||
/* Type used for indexes in the word tree need to be at least 3 bytes. If int
|
||||
/* Type used for indexes in the word tree need to be at least 4 bytes. If int
|
||||
* is 8 bytes we could use something smaller, but what? */
|
||||
#if SIZEOF_INT > 2
|
||||
#if SIZEOF_INT > 3
|
||||
typedef int idx_T;
|
||||
#else
|
||||
typedef long idx_T;
|
||||
|
@ -986,8 +986,8 @@ find_word(mip, mode)
|
|||
idx_T lo, hi, m;
|
||||
#ifdef FEAT_MBYTE
|
||||
char_u *s;
|
||||
char_u *p;
|
||||
#endif
|
||||
char_u *p;
|
||||
int res = SP_BAD;
|
||||
slang_T *slang = mip->mi_lp->lp_slang;
|
||||
unsigned flags;
|
||||
|
@ -1218,11 +1218,14 @@ find_word(mip, mode)
|
|||
* Makes you wonder why someone puts a compound flag on a word
|
||||
* that's too short... Myspell compatibility requires this
|
||||
* anyway. */
|
||||
if (((unsigned)flags >> 24) == 0 || wlen < slang->sl_compminlen)
|
||||
if (((unsigned)flags >> 24) == 0
|
||||
|| wlen - mip->mi_compoff < slang->sl_compminlen)
|
||||
continue;
|
||||
|
||||
/* Limit the number of compound words to COMPOUNDMAX. */
|
||||
if (!word_ends && mip->mi_complen + 2 > slang->sl_compmax)
|
||||
/* Limit the number of compound words to COMPOUNDMAX if no
|
||||
* maximum for syllables is specified. */
|
||||
if (!word_ends && mip->mi_complen + 2 > slang->sl_compmax
|
||||
&& slang->sl_compsylmax == MAXWLEN)
|
||||
continue;
|
||||
|
||||
/* Quickly check if compounding is possible with this flag. */
|
||||
|
@ -1232,6 +1235,44 @@ find_word(mip, mode)
|
|||
((unsigned)flags >> 24)) == NULL)
|
||||
continue;
|
||||
|
||||
if (mode == FIND_COMPOUND)
|
||||
{
|
||||
int capflags;
|
||||
|
||||
/* Need to check the caps type of the appended compound
|
||||
* word. */
|
||||
#ifdef FEAT_MBYTE
|
||||
if (has_mbyte && STRNCMP(ptr, mip->mi_word,
|
||||
mip->mi_compoff) != 0)
|
||||
{
|
||||
/* case folding may have changed the length */
|
||||
p = mip->mi_word;
|
||||
for (s = ptr; s < ptr + mip->mi_compoff; mb_ptr_adv(s))
|
||||
mb_ptr_adv(p);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
p = mip->mi_word + mip->mi_compoff;
|
||||
capflags = captype(p, mip->mi_word + wlen);
|
||||
if (capflags == WF_KEEPCAP || (capflags == WF_ALLCAP
|
||||
&& (flags & WF_FIXCAP) != 0))
|
||||
continue;
|
||||
|
||||
if (capflags != WF_ALLCAP)
|
||||
{
|
||||
/* When the character before the word is a word
|
||||
* character we do not accept a Onecap word. We do
|
||||
* accept a no-caps word, even when the dictionary
|
||||
* word specifies ONECAP. */
|
||||
mb_ptr_back(mip->mi_word, p);
|
||||
if (spell_iswordp_nmw(p)
|
||||
? capflags == WF_ONECAP
|
||||
: (flags & WF_ONECAP) != 0
|
||||
&& capflags != WF_ONECAP)
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
/* If the word ends the sequence of compound flags of the
|
||||
* words must match with one of the COMPOUNDFLAGS items and
|
||||
* the number of syllables must not be too large. */
|
||||
|
@ -1348,10 +1389,12 @@ can_compound(slang, word, flags)
|
|||
if (!vim_regexec(®match, flags, 0))
|
||||
return FALSE;
|
||||
|
||||
/* Count the number of syllables. This may be slow, do it last. */
|
||||
/* Count the number of syllables. This may be slow, do it last. If there
|
||||
* are too many syllables AND the number of compound words is above
|
||||
* COMPOUNDMAX then compounding is not allowed. */
|
||||
if (slang->sl_compsylmax < MAXWLEN
|
||||
&& count_syllables(slang, word) > slang->sl_compsylmax)
|
||||
return FALSE;
|
||||
return STRLEN(flags) < slang->sl_compmax;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -8596,11 +8639,22 @@ suggest_try_change(su)
|
|||
break;
|
||||
compflags[sp->ts_complen] = ((unsigned)flags >> 24);
|
||||
compflags[sp->ts_complen + 1] = NUL;
|
||||
if (fword_ends && !can_compound(slang,
|
||||
tword + sp->ts_splitoff,
|
||||
vim_strncpy(preword + sp->ts_prewordlen,
|
||||
tword + sp->ts_splitoff,
|
||||
sp->ts_twordlen - sp->ts_splitoff);
|
||||
p = preword;
|
||||
while (*skiptowhite(p) != NUL)
|
||||
p = skipwhite(skiptowhite(p));
|
||||
if (fword_ends && !can_compound(slang, p,
|
||||
compflags + sp->ts_compsplit))
|
||||
break;
|
||||
|
||||
/* Get pointer to last char of previous word. */
|
||||
p = preword + sp->ts_prewordlen;
|
||||
mb_ptr_back(preword, p);
|
||||
}
|
||||
else
|
||||
p = NULL;
|
||||
|
||||
/*
|
||||
* Form the word with proper case in preword.
|
||||
|
@ -8624,8 +8678,14 @@ suggest_try_change(su)
|
|||
#endif
|
||||
)
|
||||
c = WF_ONECAP;
|
||||
c |= flags;
|
||||
|
||||
/* When appending a compound word after a word character
|
||||
* don't use Onecap. */
|
||||
if (p != NULL && spell_iswordp_nmw(p))
|
||||
c &= ~WF_ONECAP;
|
||||
make_case_word(tword + sp->ts_splitoff,
|
||||
preword + sp->ts_prewordlen, flags | c);
|
||||
preword + sp->ts_prewordlen, c);
|
||||
}
|
||||
|
||||
/* Don't use a banned word. It may appear again as a good
|
||||
|
@ -8702,8 +8762,9 @@ suggest_try_change(su)
|
|||
&& ((unsigned)flags >> 24) != 0
|
||||
&& sp->ts_twordlen - sp->ts_splitoff
|
||||
>= slang->sl_compminlen
|
||||
&& sp->ts_complen + 1 - sp->ts_compsplit
|
||||
< slang->sl_compmax
|
||||
&& (slang->sl_compsylmax < MAXWLEN
|
||||
|| sp->ts_complen + 1 - sp->ts_compsplit
|
||||
< slang->sl_compmax)
|
||||
&& (vim_strchr(sp->ts_complen == sp->ts_compsplit
|
||||
? slang->sl_compstartflags
|
||||
: slang->sl_compallflags,
|
||||
|
@ -8733,9 +8794,11 @@ suggest_try_change(su)
|
|||
{
|
||||
/* If we're going to split need to check that the
|
||||
* words so far are valid for compounding. */
|
||||
p = preword;
|
||||
while (*skiptowhite(p) != NUL)
|
||||
p = skipwhite(skiptowhite(p));
|
||||
if (sp->ts_complen > sp->ts_compsplit
|
||||
&& !can_compound(slang,
|
||||
tword + sp->ts_splitoff,
|
||||
&& !can_compound(slang, p,
|
||||
compflags + sp->ts_compsplit))
|
||||
break;
|
||||
newscore += SCORE_SPLIT;
|
||||
|
|
Loading…
Add table
Reference in a new issue